I have an abstract base class, call it ABC. It has two derived classes, say Derived1 and Derived2. In another class, I need an array of objects of either Derived1 or Derived2. The problem is I don't know if the array elements should be of type Derived1 or Derived2 until run time. (I have a variable called "mode", and the value of mode determines if the array should contain Derived1 or Derived2 objects.) I can't seem to create an array of ABC pointers since you can't create instances of an abstract class. So how can I create this array?
Thank you!!
Thank you!!