All challenges
Multiple ChoiceIntermediate 45s

CRTP static polymorphism

The Curiously Recurring Template Pattern (`class D : public Base<D>`) enables:
Options
  1. 1Runtime polymorphism that is faster than virtual functions because it uses a special vtable.
  2. 2Static (compile-time) polymorphism, letting Base cast `this` to D& and call D's methods without a vtable.
  3. 3The complete prevention of all inheritance from the derived class, sealing it as final.
  4. 4The automatic generation of a virtual destructor for every class in the CRTP hierarchy.

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