Hi again!
I`ve puzzled the next one rather long, and I´m pretty stuck with it:
Code:
void loadAnimals(const vector<Animal*> *animals, const char* filename)
{
...
...
// open file, etc.
...
Animal *animal = NULL;
// bunch of code to read animal data from the file.
// the animal`s type (inheritance) is determined here
// this part works fine.
// for example, animal = new Dog();
// puzzled about this
animals->push_back(*animal); // won`t compile
// animals->push_back(&animal); // won`t compile
}
how do I push the object into the vector?