On 2026-10-14, Remy Porter reported a C++ anecdote involving Mandy's coworker. The coworker had adopted virtual inheritance as a default rule and used it consistently.
Virtual inheritance addresses the diamond problem in multiple inheritance. A is the base class. B and C derive from A, while D derives from both. Without virtual inheritance, D contains two internal copies of A and its members. With `class B : public virtual A`, D receives a single copy of A. The mechanism matters only when a class has derived classes.
That condition is absent from the example. `SomeSpecificDerivedClass` is declared `final`, so no class can inherit from it. Adding `virtual` to its inheritance from `SomeBaseClass` therefore has no effect.




Comments
No comments yet — be the first.
Open the discussion
No account or password needed — just enter your e-mail and we’ll send you a one-time sign-in link. First time here? You’re set up automatically.
Your rating will be applied automatically after you sign in.
Check your inbox
We’ve sent a sign-in link to …. Open it on this device — this tab will sign you in automatically.
Nothing arrived? Check your spam folder — and mark the mail as "Not spam" so it lands in your inbox next time.