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

What problem does virtual inheritance solve?

  1. A The diamond problem, where a class would otherwise contain two copies of a shared base
  2. B Slow virtual function dispatch
  3. C Memory fragmentation
  4. D Template instantiation errors
Answer

The diamond problem, where a class would otherwise contain two copies of a shared base

Declaring the intermediate bases as virtual ensures a single shared base subobject, resolving the ambiguity.

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