final specifier
Da 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. |
Especifica que uma função virtual não pode ser substituído em uma classe derivada ou que uma classe não pode ser herdada
Original:
Specifies that a função virtual 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.
Índice |
[editar] Sintaxe
function_declaration final ;
|
|||||||||
class class_name final base_classes
|
|||||||||
Esta seção está incompleta Motivo: function_declaration is probably wrong terminology |
[editar] Explicação
Quando usado em uma declaração de função virtual,
final
especifica que a função não pode ser substituído por classes derivadas.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 é um identificador com um significado especial quando usado em uma declaração de função membro ou chefe de classe. Noutros contextos, não é reservada e pode ser utilizado para objectos de nomes e funções.
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.
[editar] Exemplo
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 { };
[editar] Veja também
- substituir especificador (desde C++11)