We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

Compiler Warning C4484

'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 {}