If a base class destructor is not virtual then :
MH SET - 2018, SET Exam - 2018,
Answer: C
If the base class destructor is not virtual, the destructor in the derived class cannot be called when the object is accessed through a pointer to the base class.
When delete is applied to a base class pointer that points to a derived object, the destructor is chosen by the pointer's static type unless it is virtual. Only the base class destructor runs, so the derived part is not cleaned up, which can leak resources (strictly, the behaviour is undefined).
A non-virtual base destructor can still be called and still has a body. It is the derived class destructor, not the base one, that is skipped, so options A, B and D are wrong.
Please log in or register to report this question.