final specifier
De 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 una función virtual no se puede reemplazar en una clase derivada, o que una clase no se puede heredar
Original:
Specifies that a función 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.
Contenido |
[editar] Sintaxis
function_declaration final ;
|
|||||||||
class class_name final base_classes
|
|||||||||
| Esta sección está incompleta Razón: function_declaration is probably wrong terminology |
[editar] Explicación
Cuando se utiliza en una declaración de función virtual,
final especifica que la función no puede ser anulado por las clases 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 es un identificador que tiene un significado especial cuando se utiliza en una declaración de la función miembro o de la cabeza de clases. En otros contextos, no está reservado y puede ser usado para nombrar objetos y funciones .
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] Ejemplo
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] Ver también
- anular especificador (desde C++11)

