Why must a base class intended for polymorphic deletion have a virtual destructor?
- A To improve performance
- B Otherwise deleting through a base pointer only runs the base destructor, leaking derived resources
- C To allow inheritance at all
- D To enable copy construction
Answer
Otherwise deleting through a base pointer only runs the base destructor, leaking derived resources
Deleting a derived object through a base pointer without a virtual destructor is undefined behaviour and typically leaks the derived class's resources.





