Hi, i wish to store a mix of derived classes in one array.
so i make the array from the base class i.e.
Base* array[11];
and fill it with my classes.
The base class has a method.
Base::print();
this is overridden in all the child classes and used as follows,
array[0]->print();
array[1]->print();
my problem arises when array[x] is a 2nd derived class i.e.
base--->1stderived class--->2nd derived class
it will only access the print() of the 1st derived class.
i.e. the 2ndDerivedClass::print() is NEVER accessed by the program.
NOTE:
Base* one = new 2ndDerivedClass(..arguments..);
one->print();
WORKS FINE!!
the problem ONLY happens when the 2ndDerivedClass is stored in the array.
Please help :(