final specifier
Aus cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Gibt an, dass ein virtuelle Funktion kann nicht in einer abgeleiteten Klasse oder eine Klasse kann nicht vererbt werden überschrieben
Original:
Specifies that a virtuelle Funktion can not be overridden in a derived class or that a class cannot be inherited
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten] Syntax
function_declaration final ;
|
|||||||||
class class_name final base_classes
|
|||||||||
This section is incomplete Reason: function_declaration is probably wrong terminology |
[Bearbeiten] Erklärung
Wenn in einer virtuellen Funktion Erklärung verwendet wird, gibt
final
, dass die Funktion kann nicht überschrieben werden von abgeleiteten Klassen .Original:
When used in a virtual function declaration,
final
specifies that the function may not be overridden by derived classes.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
final ist eine Kennung mit einer besonderen Bedeutung, wenn in einem Mitgliedstaat Funktion Erklärung oder Klasse Kopf verwendet. In anderen Zusammenhängen ist nicht reserviert und kann zu Namen Objekte und Funktionen verwendet werden .
Original:
final is an identifier with a special meaning when used in a member function declaration or class head. In other contexts it is not reserved and may be used to name objects and functions.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Beispiel
struct A { virtual void foo() final; }; struct B final : A { void foo(); // Error: foo cannot be overridden as it's final in A }; struct C : B // Error: B is final { };
[Bearbeiten] Siehe auch
- Überschreibungsspezifizierer (seit C++11)