All challenges
Multiple ChoiceHard 45s

Virtual base construction order

With virtual bases, which class is responsible for initializing the virtual base A?
Options
  1. 1The immediate base, either B or C, whichever one happens to be constructed first in the chain.
  2. 2The compiler generates the initialization automatically from the virtual base's default constructor.
  3. 3A's default constructor is always used, regardless of what any derived class's initializer says.
  4. 4The most-derived class (D), which must name A in its mem-initializer list; intermediate classes' initializations of A are ignored.

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