All challenges
Multiple ChoiceHard 45s

final on class disables devirtualization?

Marking a class or function `final` may let the compiler:
Options
  1. 1Remove the vtable entirely from the object's layout, shrinking every instance by one pointer.
  2. 2Devirtualize calls (skip vtable lookup) when it can prove the dynamic type through the static type.
  3. 3Convert all of the class's methods to static functions, since dispatch can be resolved at compile time.
  4. 4Guarantee that the class cannot have a non-virtual destructor, since final classes forbid virtual bases.

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