Compiler Error C3254

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C3254.

explicit override' : class contains explicit override 'override' but does not derive from an interface that contains the function declaration

When you explicitly override a method, the class that contains the override must derive, directly or indirectly, from the type that contains the function you are overriding.

The following sample generates C3254:

// C3254.cpp  
__interface I  
{  
   void f();  
};  
  
__interface I1 : I  
{  
};  
  
struct A /* : I1 */  
{  
   void I1::f()  
   {   // C3254, uncomment : I1 to resolve this C3254  
   }  
};  
  
int main()  
{  
}  

Show: