-
Linked LIst error
I'm currently working on a linked list program where I use nodes inside of a header file for another class. I'm using this syntax in the header file where the node is defined as a struct under the private section:
Code:
head->next=new Node;
yet when I compile, it gives me errors that I don't have a constructor for the "StoreList::Node" class...how exactly do I get around this.... OR.....what is the syntax I need to define a simple one that does nothing (I dont need it to)...
I'vs Tried doing the
Code:
StoreList::Node()
{}
and
Code:
StoreList::Node::Node()
{}
to no avail
Appreciate any help,
Arm
-
Not sure why it's giving that specific error as it seems the real problem is that the nested 'Node' class is private...
Your options in that case would either be to provide a member function (in the class that holds this private data) that will spit out a 'Node' or else simply make the''Node' class public.