Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


override indicates that a member of a managed type must override a base class or a base interface member. If there is no member to override, the compiler will generate an error.

override is also valid when compiling for native targets (without /clr). See Override Specifiers and Native Compilations for more information.

override is a context-sensitive keyword. See Context-Sensitive Keywords for more information.

// override_keyword.cpp
// compile with: /clr /c
ref struct I1 {
   virtual void f();

ref struct X : public I1 {
   virtual void f() override {}

This sample shows that override can also be used in native compilations.

// override_keyword_2.cpp
// compile with: /c
struct I1 {
   virtual void f();

struct X : public I1 {
   virtual void f() override {}

Compiler option: /clr

Community Additions

© 2015 Microsoft