final 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 non può essere sottoposto a override in una classe derivata o che una classe non può essere ereditata
Original:
Specifies that a funzione virtuale 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.
Indice |
[modifica]Sintassi
function_declarationfinal ; | |||||||||
class class_namefinal base_classes | |||||||||
This section is incomplete Reason: function_declaration is probably wrong terminology |
[modifica]Spiegazione
Quando viene utilizzato in una dichiarazione di funzione virtuale,
final
specifica che la funzione non può essere sostituito dalle classi derivate.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 è un identificatore con un significato particolare quando viene utilizzato in una dichiarazione di funzione membro di una classe o la testa. In altri contesti non è riservato e può essere utilizzata per nome oggetti e funzioni.
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.
[modifica]Esempio
struct A {virtualvoid 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{};
[modifica]Vedi anche
- ignorare specificatore(dal C++11)