Archive

Archive for July, 2020

You cannot call derived member function in the base destructor!

July 25th, 2020 Comments off

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: ,