Are there any specific reasons to use non-virtual destructors?
问题 As I know, any class that is designated to have subclasses should be declared with virtual destructor, so class instances can be destroyed properly when accessing them through pointers. But why it's even possible to declare such class with non-virtual destructor? I believe compiler can decide when to use virtual destructors. So, is it a C++ design oversight, or am I missing something? 回答1: Are there any specific reasons to use non-virtual destructors? Yes, there are. Mainly, it boils down to