|
|
|
|
Deleting an object through pointer to base invokes undefined behavior unless the destructor in the base class is virtual. ... A common guideline is that a destructor for a base class must be either public and virtual or protected and nonvirtual https://en.cppreference.com/w/cpp/language/destructor#Virtual_destructors |