I have a class with a few class members and a polymorphic member:
class Container{
Container::Container(){ p = new Derived();}
Poly* p;
A a;
B b;
};
I would like to allocate the memory for the actual polymorphic object Container::p points to, contiguously after Container::b, rather than via the default new() and therefore malloc().
What is the best way to achieve this?