共用方式為


編譯器錯誤 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;
};