共用方式為


編譯器錯誤 C3903

'property':沒有 set 或 get 方法

屬性必須至少有 getset 方法。 如需詳細資訊,請參閱 property

下列範例會產生 C3903:

// C3903.cpp
// compile with: /clr
ref class X {
   property int P {
      void f(int){}
      // Add one or both of the following lines.
      // void set(int){}
      // int get(){return 0;}
   };   // C3903

   property double Q[,,,,] {
      void f(){}
      // Add one or both of the following lines.
      // void set(int, char, int, char, double, double){}
      // double get(int, char, int, char, double){return 1.1;}
   }   // C3903
};