Should base class destructors be virtual?
Show answer and explanation
Use a public virtual destructor for a base intended to be deleted polymorphically. Use a protected non-virtual destructor when deletion through the base must be forbidden; not every base class needs virtual destruction.
Use a public virtual destructor for a base intended to be deleted polymorphically. Use a protected non-virtual destructor when deletion through the base must be forbidden; not every base class needs virtual destruction.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.