Skip to content

Latest commit

 

History

History
80 lines (57 loc) · 2.07 KB

override-cpp-component-extensions.md

File metadata and controls

80 lines (57 loc) · 2.07 KB
descriptiontitlems.datems.topichelpviewer_keywordsms.assetid
Learn more about: override (C++/CLI and C++/CX)
override (C++/CLI and C++/CX)
11/04/2016
reference
overriding, override keyword [C++]
override keyword [C++]
34d19257-1686-4fcd-96f5-af07c70ba914

override (C++/CLI and C++/CX)

The override context-sensitive keyword indicates that a member of a type overrides a base class or a base interface member.

Remarks

The override keyword is valid when compiling for native targets (default compiler option), Windows Runtime targets (/ZW compiler option), or common language runtime targets (/clr compiler option).

For more information about override specifiers, see override Specifier and Override Specifiers and Native Compilations.

For more information about context-sensitive keywords, see Context-Sensitive Keywords.

Examples

The following code example shows that override can also be used in native compilations.

// override_keyword_1.cpp// compile with: /cstructI1 { virtualvoidf(); }; structX : publicI1 { virtualvoidf() override {} };

Windows Runtime example

The following code example shows that override can be used in Windows Runtime compilations.

// override_keyword_2.cpp// compile with: /ZW /c ref structI1 { virtualvoidf(); }; ref structX : publicI1 { virtualvoidf() override {} };

Requirements

Compiler option: /ZW

C++/CLI example

The following code example shows that override can be used in common language runtime compilations.

// override_keyword_3.cpp// compile with: /clr /c ref structI1 { virtualvoidf(); }; ref structX : publicI1 { virtualvoidf() override {} };

Requirements

Compiler option: /clr

See also

override Specifier
Override Specifiers

close