共用方式為


編譯器錯誤 C3914

預設屬性不可為靜態

默認屬性未正確宣告。 如需詳細資訊,請參閱 如何:在 C++/CLI 中使用屬性。

範例

下列範例會產生 C3914,並示範如何修正它。

// C3914.cpp
// compile with: /clr /c
ref struct X {
   static property int default[int] {   // C3914
   // try the following line instead
   // property int default[int] {
      int get(int) { return 0; }
      void set(int, int) {}
   }
};