override specifier
Da cppreference.com.
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Specifica che un funzione virtuale sostituisce un'altra funzione virtual.
Original:
Specifies that a funzione virtuale overrides another virtual function.
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.
Indice |
[modifica]Sintassi
function_declarationoverride ; | |||||||||
This section is incomplete Reason: function_declaration is probably wrong terminology |
[modifica]Spiegazione
In una dichiarazione di metodo,
override
specifica che la funzione deve essere l'override di un metodo della classe base.Original:
In a method declaration,
override
specifies that the function must be overriding a base class method.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.
override è un identificatore con un significato particolare quando viene utilizzato dopo la dichiarazione di funzione, altrimenti non è riservato.
Original:
override is an identifier with a special meaning when used after function declaration, otherwise it's not reserved.
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.
[modifica]Esempio
struct A {virtualvoid foo();void bar();}; struct B : A {void foo()const override;// Error: Has a different signature from A::foovoid foo() override;// OK: base class contains a virtual function with the same signaturevoid bar() override;// Error: B::bar doesn't override because A::bar is not virtual};
[modifica]Vedi anche
- identificatore finale(dal C++11)