Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) C4488

'function' : requires 'keyword' keyword to implement the interface method 'interface_method'

A class must implement all members of an interface from which it directly inherits. An implemented member must have public accessibility, and must be marked virtual.

C4488 can occur if an implemented member is not public. The following sample generates C4488.

// C4488.cpp
// compile with: /clr /c /W1 /WX
interface struct MyI {
   void f1();
};

// implemented member not public
ref class B : MyI { virtual void f1() {} };  // C4488

// OK
ref class C : MyI {
public:
   virtual void f1() {}
};

C4488 can occur if an implemented member is not marked virtual. The following sample generates C4488.

// C4488_b.cpp
// compile with: /clr /c /W1 /WX
interface struct MyI {
   void f1();
};

ref struct B : MyI { void f1() {} };   // C4488
ref struct C : MyI { virtual void f1() {} };   // OK
Show:
© 2014 Microsoft