Compiler Warning C4484
Collapse the table of content
Expand the table of content
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. ArchiveDisclaimer

Compiler Warning C4484

Error Message

'override_function' : matches base ref class method 'base_class_function', but is not marked 'virtual', 'new' or 'override'; 'new' (and not 'virtual') is assumed

When compiling with /clr, the compiler will not implicitly override a base class function, which means the function will get a new slot in the vtable. To resolve, explicitly specify whether a function is an override.

For more information, see:

C4484 is always issued as an error. Use the warning pragma to suppress C4484.


The following sample generates C4484.

// C4484.cpp
// compile with: /clr
ref struct A {
   virtual void Test() {}

ref struct B : A {
   void Test() {}   // C4484

// OK
ref struct C {
   virtual void Test() {}
   virtual void Test2() {}

ref struct D : C {
   virtual void Test() new {}
   virtual void Test2() override {}
© 2016 Microsoft