Deleting downcast not invoking destructor - any idea?
OK, here is the prob.
I create a class, A, and B as a derived class thereof.
When I use
A* classAPointerThatIsActuallyB = new B;
then the constructors for A and B are called.
When I call a virtual from A that B overrides, the B function is called. Basic polymorphism there.
But, when I
Only the destructor for A is called. Any ideas on how would I go about making sure that anything done by B::B() is properly undone by B::~B(), without modifying class A?