override 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 anula otra función virtual .
Original:
Specifies that a función virtual 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.
Contenido |
[editar] Sintaxis
function_declaration override ;
|
|||||||||
| Esta sección está incompleta Razón: function_declaration is probably wrong terminology |
[editar] Explicación
En una declaración de método,
override especifica que la función debe ser preponderante en un método de la clase 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 es un identificador que tiene un significado especial cuando se usa después de declaración de la función, de lo contrario no es reservado .
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.
[editar] Ejemplo
struct A { virtual void foo(); void bar(); }; struct B : A { void foo() const override; // Error: Has a different signature from A::foo void foo() override; // OK: base class contains a virtual function with the same signature void bar() override; // Error: B::bar doesn't override because A::bar is not virtual };
[editar] Ver también
- último especificador (desde C++11)

