Hacker News new | ask | show | jobs
by tomjen3 5690 days ago
Why? If they don't it is going to mess up the destruction sequence if they are ever stored and then released polymorphically, such as from a collection of pointers to classes.

What he is saying is standard C++ knowledge.

2 comments

You can also use a protected non-virtual destructor in the base class to avoid to mess up the destruction sequence. But what he says is indeed the most common case.
Sometimes an alternative is to make the destructor in the base class protected.