编译器错误 C3766
“type”必须提供接口方法“function”的实现
继承自接口的类必须实现接口成员。
示例
以下示例生成 C3766。
// C3766.cpp
// compile with: /clr /c
delegate void MyDel();
interface struct IFace {
virtual event MyDel ^ E;
};
ref struct Class1 : public IFace {}; // C3766
// OK
ref struct Class2 : public IFace {
virtual event MyDel ^ E {
void add(MyDel ^) {}
void remove(MyDel ^) {}
}
};