Namespaces
Variants

C++ identifier with special meaning: override (since C++11)

From cppreference.net
C++ language
General topics
Flow control
Conditional execution statements
Iteration statements (loops)
Jump statements
Functions
Function declaration
Lambda function expression
inline specifier
Dynamic exception specifications ( until C++17* )
noexcept specifier (C++11)
Exceptions
Namespaces
Types
Specifiers
constexpr (C++11)
consteval (C++20)
constinit (C++20)
Storage duration specifiers
Initialization
Expressions
Alternative representations
Literals
Boolean - Integer - Floating-point
Character - String - nullptr (C++11)
User-defined (C++11)
Utilities
Attributes (C++11)
Types
typedef declaration
Type alias declaration (C++11)
Casts
Memory allocation
Classes
Class-specific function properties
Special member functions
Templates
Miscellaneous

Utilisation

Exemple

struct b
{
    void f0() {};
    void f1() {};
    virtual void f2() {};
    virtual void f3() {};
    virtual void f4() {};
    virtual void f5() {};
};
struct d : b
{
    void f0() {};                        // OK. Ni b::f0 ni d::f0 ne sont virtuelles.
    void f1() override {};               // Erreur : impossible de redéfinir b::f1 non virtuelle.
    void f2() override {};               // OK. La fonction membre d::f2 est virtuelle.
    virtual void f3() {};                // OK. Le spécificateur 'override' est optionnel.
    virtual void f4() override {};       // OK. 'override' garantit que b::f4 est virtuelle.
    virtual void f5() override final {}; // OK. d::f5 est à la fois redéfinie et finale.
};

Voir aussi