Override specifier

Introduced by: C++11

Overriding virtual functions is one of the most important mechanisms of C++ object oriented programming. The derived class method is overriding base class method when following requirements are met:

  1.  the base class method has virtual keyword,
  2. derived class method has:
    • the same name,
    • the same input parameters,
    • the same const-ness,
    • compatible return type.

If at least one of these requirement is not fulfilled, developer can end with not-overriding method and not even know about it. The C++11 standard introduces specifier override, designed for easy detection of such mistakes.

Continue reading