All challenges
Multiple ChoiceIntermediate 45s

Diamond inheritance ambiguity

In a diamond hierarchy where B and C both virtually inherit A, and D inherits B and C, how many A sub-objects does D contain, and does D::a become ambiguous?
Options
  1. 1Two A sub-objects; accessing a member is always ambiguous.
  2. 2Two A sub-objects; virtual base merges only the vtables.
  3. 3One A sub-object (virtual base is shared); no ambiguity for a single member.
  4. 4Zero; virtual inheritance removes A entirely.

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle