What problem does virtual inheritance solve?
- A The diamond problem, where a class would otherwise contain two copies of a shared base
- B Slow virtual function dispatch
- C Memory fragmentation
- 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.





