Specifies that a virtual function overrides another virtual function.
The identifier override
, if used, appears immediately after the declarator in the syntax of a member function declaration or a member function definition inside a class definition.
declarator virt-specifier-seq(optional) pure-specifier(optional) | (1) | |
declarator virt-specifier-seq(optional) function-body | (2) |
override
may appear in virt-specifier-seq immediately after the declarator, and before the pure-specifier, if used.override
may appear in virt-specifier-seq immediately after the declarator and just before function-body.In both cases, virt-specifier-seq, if used, is either override
or final, or final override
or override final
.
In a member function declaration or definition, override
ensures that the function is virtual and is overriding a virtual function from a base class. The program is ill-formed (a compile-time error is generated) if this is not true.
override
is an identifier with a special meaning when used after member function declarators: it's not a reserved keyword otherwise.
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/language/override