Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Why must a base class intended for polymorphic deletion have a virtual destructor?

  1. A To improve performance
  2. B Otherwise deleting through a base pointer only runs the base destructor, leaking derived resources
  3. C To allow inheritance at all
  4. 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.

All C++ MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as