编译器错误 C2844

“member”:不能是接口“interface”的成员

除非接口类也是属性,否则它不能包含数据成员。

接口中不允许属性或成员函数以外的任何内容。 另外,不允许构造函数、析构函数和运算符。

以下示例生成 C2844:

// C2844a.cpp
// compile with: /clr /c
public interface class IFace {
   int i;   // C2844
   // try the following line instead
   // property int Size;
};