It has been suggested that this article be
merged into
C++ classes. (
Discuss) Proposed since April 2024. |
final
is a
keyword in the
C++ programming language.
[1] It limits the ways in which a
class can be
subclassed. Subclasses of a class are prevented from overriding methods marked as final
by the parent class.
[2]
[3] Final classes cannot be inherited.
[3] This allows devirtualization, the removal of the use of
vtables for method lookup, thus allowing the
inlining of method calls on final classes.
[4]
[5]
final
is not a
reserved word in C++, and is instead defined as a
contextual keyword, in order to not conflict with uses of the identifier 'final' in existing codebases.
[6]
[7]
This article needs additional or more specific
categories. (April 2024) |
It has been suggested that this article be
merged into
C++ classes. (
Discuss) Proposed since April 2024. |
final
is a
keyword in the
C++ programming language.
[1] It limits the ways in which a
class can be
subclassed. Subclasses of a class are prevented from overriding methods marked as final
by the parent class.
[2]
[3] Final classes cannot be inherited.
[3] This allows devirtualization, the removal of the use of
vtables for method lookup, thus allowing the
inlining of method calls on final classes.
[4]
[5]
final
is not a
reserved word in C++, and is instead defined as a
contextual keyword, in order to not conflict with uses of the identifier 'final' in existing codebases.
[6]
[7]
This article needs additional or more specific
categories. (April 2024) |