When to use virtual destructors?

Virtual destructors are useful when you might potentially delete an instance of a derived class through a pointer to base class: Here, you’ll notice that I didn’t declare Base’s destructor to be virtual. Now, let’s have a look at the following snippet: Since Base’s destructor is not virtual and b is a Base* pointing to … Read more