I was wondering how you can do polymorphism with references, as opposed to pointers.
To clarify, see the following minimal example:
cl
Still, is there a real need for dynamic memory allocation in this case?
No. Just define A1 first and then make it a normal member of B.
Polymorphism works just fine with both references and pointers.