How would one go about making a link list of objects assuming i already have the class made?
How would one go about making a link list of objects assuming i already have the class made?
You could use #include <list> and use std::list, which is a doubly linked list class template.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
You already made the class, correct? Where are you stuck exactly?
well, i wrote a previous program where i used a linked list of structs to represent a polynomial broken up into its coeffficients and powers and then passed the pointer to the first structs to various functions to do operations. Now i need the same thing but using objects. I want to create an object with a coefficient and power which is linked to another object that has a coefficient and power and so on until it reaches a null character but i'm not sure, once i create the first object with a constructer, how to link the next one to it
Well as the kindly laserlight pointed out the stl provides you with a generic template class for *drum roll* linked lists. Just use that.
Yeah you'll need to better show us what you are having trouble with, in other words, code.
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"
More info about STL Lists: http://www.cppreference.com/cpplist/index.htmlCode:std::list<YourClassNameGoesHere> listVar; YourClassNameGoesHere obj; listVar.push_back( obj ); ...