次の方法で共有


コンパイラ エラー 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) {}
   }
};