Compiler Error C3764


For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

'override_function': cannot override base class method 'base_class_function'

The compiler detected an ill-formed override. For example, the base class function was not virtual. For more information, see override.

The following sample generates C3764.

// C3764.cpp  
// compile with: /clr /c  
public ref struct A {  
   void g(int);  
   virtual void h(int);  
public ref struct B : A {  
   virtual void g(int) override {}   // C3764  
   virtual void h(int) override {}   // OK  

C3764 can also occur when a base class method is both explicitly and named overridden. The following sample generates C3764.

// C3764_b.cpp  
// compile with: /clr /c  
ref struct A {  
   virtual void Test() {}  
ref struct B : public A {  
   virtual void Test() override {}  
   virtual void Test2() = A::Test {}   // C3764