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

사용법

예제

struct b
{
    void f0() {};
    void f1() {};
    virtual void f2() {};
    virtual void f3() {};
    virtual void f4() {};
    virtual void f5() {};
};
struct d : b
{
    void f0() {};                        // OK. b::f0와 d::f0 모두 가상 함수가 아님
    void f1() override {};               // 오류: 비가상 함수 b::f1을 재정의할 수 없음
    void f2() override {};               // OK. 멤버 함수 d::f2는 가상 함수임
    virtual void f3() {};                // OK. 'override' 지정자는 선택사항임
    virtual void f4() override {};       // OK. 'override'는 b::f4가 가상 함수임을 보장함
    virtual void f5() override final {}; // OK. d::f5는 재정의되었으며 final임
};

참고 항목