linked list class
node classCode:class LinkedList { public: LinkedList(); // constructor ~LinkedList(); //destructor private: Node * headPtr; //wont let me do this why ??? };
im trying to make a linked list. not sure if this is the correct way.Code:class Node { public: Node(); ~Node(); //destructor Node* nextPtr; int item; };
basically i have a headPtr that points to the head of hte list. But i cant seem to define it in LInkedlist.h.
I want to define it there because all the funcitons in LinkedList.cpp need to modify/read the items in the linked list..
not too sure how to do this.. if anyone could help thanks heaps