How can I create a dynamic array of objects polymorphically, if I have an abstract class with derived classes, and without using STL data structure classes? (vectors, list, etc)
A static array of objects
TwoDimensionShape *shapes[2];
shapes[0] = &Triangle("right", 8.0, 12.0);
shapes[1] = &Rectangle(10);
I know I can't do this because you cannot create objects of an abstract class:
cin >> x;
TwoDimensionShape *s = new TwoDimensionShape [x];
EDIT:
Thanks to Nick, this works:
int x = 5;
TwoDimensionShape **shapes = new (TwoDimensionShape*[x]);