I am having trouble figuring out how i can store new object into a vector, and be able to pull that information out.
What i am trying to do is, storing different data from files in a series of objects, then going through these objects and pulling out the information.
I am looking for something like this:
vector<myClass> list;
while( i < nFiles)
{
myClass *temp = new myClass;
list.push_back(temp);
temp->setSomething();
i++;
}
I want to have a different object for every nFile cycle, so i am able to later go through each object and pull the information out from each object.
I've tried pushing the temp to a vector but its giving me nothing but errors.
Is what i'm trying to do programatically correct? I can't get my head around this. Any sort of help would be much appreciated. Thank you.