Erreur du compilateur C3914

Une propriété par défaut ne peut pas être statique

Une propriété par défaut a été déclarée incorrectement. Pour plus d’informations, consultez How to : Use Properties in C++/CLI.

Exemple

L’exemple suivant génère l’erreur C3914 et montre comment la corriger.

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