Okay, here's the main change to split 'list' and 'node' apart:
Code:template <typename T> class node { T nodeValue; node<T> *next; public: node() : next(NULL) {} node(const T& item, node<T> *nextNode = NULL) : nodeValue(item), next(nextNode) {} }; template <typename T> class list { node<T> *head; public: void addAtFront(const T val); void addAtBack(const T val); void outputList() const; };
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
I replaced the code and got an error saying that it could not access "next" because it was a private member. So I tried putting it into the public section and now there's no compile error, but I'm getting the ''Linked list.exe has encountered a problem" error with a blank screen as output.
Is this a good tutorial to start out with?Get familiar! That's all I'm saying.
You will need it in the future. Why wait, when it can make life so much easier?
http://www.codeproject.com/KB/cs/Mas...Debugging.aspx
Last edited by UserName112; 12-09-2011 at 07:09 PM.