Quote:
Originally posted by grib
use std::vector<ABC *> v;
to add a Derived1 v.push_back(new Derived1(/*args if needed*/));
any calls on methods of ABC will call the Derived method iff those methods are virtual.
If you need to use something that's not in the ABC you need to use dynamic_cast<Derived1 *>(v[3]); This will give you a pointer iff v[3] actually points to a Dervived1.
Naturally, you need to rember to delete each element.
I agree with the std::vector idea, but I'd take it a step further. Download a good supplimentary library, like