共用方式為


編譯器錯誤 C3902

'存取子': 最後一個參數的類型必須是 'type'

至少一個 set 方法的最後一個參數類型必須符合 屬性的類型。 如需詳細資訊,請參閱 property

下列範例會產生 C3902:

// C3902.cpp
// compile with: /clr /c
using namespace System;
ref class X {
   property String ^Name {
      void set(int);   // C3902
      // try the following line instead
      // void set(String^){}
   }

   property double values[int,int] {
      void set(int, int, float);   // C3902
      // try the following line instead
      // void set(int, int, double){}
   }
};