Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) C4374

'function1': pure virtual function will not be overridden by non-virtual 'function2' in superclass

The compiler expected to find the virtual keyword on a method definition.

The following sample generates C4374:

// C4374.cpp
// compile with: /clr /W1
#using <mscorlib.dll>
public __gc __interface I
{
   void f();
};

public __gc struct B
{
   /* virtual */ void f()
   {
      System::Console::WriteLine("B::f()");
   }
};

public __gc struct C : B, I   // C4374, uncomment virtual to resolve
{
};

int main()
{
}
Show:
© 2014 Microsoft