In C++, polymorphism and arrays don't mix.
Since in general the size of the derived class is different to the size of the base class, polymorphism and pointer arithmetic don't play together nicely. Since array access involves pointer arithmetic, expressions such as pBase[1]
don't work as expected.
One possibility is to have an array of pointers to your objects, perhaps even smart pointers to simplify memory management. But don't forget to define a virtual destructor in Base1
.