Condividi tramite


Errore del compilatore C3914

Una proprietà predefinita non può essere statica

Una proprietà predefinita è stata dichiarata in modo non corretto. Per altre informazioni, vedere Procedura: Usare le proprietà in C++/CLI.

Esempio

L'esempio seguente genera l'errore C3914 e mostra come risolverlo.

// 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) {}
   }
};