Home > development > You cannot call derived member function in the base destructor!

You cannot call derived member function in the base destructor!

Consider the following code …

In the code you would be forgiven for thinking that the function “This()” would be called from the derived class, but in fact it is called from the base class

This is because the derived class has been deleted by the time we call the base destructor.

Moral of the story, clean up what you need to cleanup in your derived class, ’cause the base class is not going to do it for you!

Categories: development Tags: ,
  1. No comments yet.
  1. No trackbacks yet.