I have the following class hierarchy:
Shape <- Shape3d <- Sphere
And I am trying to run the following code:
I have destructors in place with cout statements. I can see that only Shape destructor is called. How do I ensure that Sphere, Shape3d and Shape destructors are called?Code:Shape *s = (Shape3d *) new Sphere(); ... delete s;
I am using Turbo C++ IDE.