class does not name a type error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xtoma
    New Member
    • Feb 2015
    • 11

    class does not name a type error

    I have two classes declared as below
    Code:
    #include<iostream>
    using namespace std;
    Class Node
    {
          double data;
          Node* Next;
          };
    Class List
    {
    public:
           bool ISEmpty()
           {
                return head == NULL;  //return function  value ,determine if empty or not
           }
          Node*InsertNode(int index,double x); //procedure: insert a new  Node at a particular position 
          int FindNode(double x);              // procedure:  search for node with a given value
          int deleteNode(double x)             //procedure: delete Node with a given value
          void Display();                      // procedure: printing all nodes in the list  
          List()(head = NULL;}                //constructor
          ~List;                              //destructor
          };

    and When I try to compile it it gives the following error:
    .class does not name a type' for(Node) and (List)
    .expected class-name before ';' token for (~List)
    . expected declration before };


    . Please help me in this regard.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Does your class begin with a capital C as shown in your post?

    Comment

    • xtoma
      New Member
      • Feb 2015
      • 11

      #3
      yes the classes begin with a capital C

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        If this is C++ you use lower case c:

        Code:
        class Node
        {
        etc...
        Last edited by weaknessforcats; Apr 8 '15, 03:47 PM. Reason: typo

        Comment

        • xtoma
          New Member
          • Feb 2015
          • 11

          #5
          Got it! Now it is crystal to me

          Comment

          Working...