All challenges
Multiple ChoiceIntermediate 45s

Calling virtual from constructor

Within a base class constructor, a call to a virtual function dispatches to:
Options
  1. 1The base version, because during base construction the dynamic type is the base.
  2. 2The most-derived override, using the not-yet-constructed dynamic type of the object.
  3. 3Undefined behavior, because calling a virtual function during construction is illegal.
  4. 4A pure virtual call, which the standard defines as well-formed and throwing.

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