编译器错误 C3908

访问级别的限制低于“construct”的限制

属性访问器方法(get 或 set)不能比属性本身指定的访问限制性更低。 对于事件访问器方法也是同样。

有关详细信息,请参阅 propertyevent

以下示例生成 C3908:

// C3908.cpp
// compile with: /clr
ref class X {
protected:
   property int i {
   public:   // C3908 property i is protected
      int get();
   private:
      void set(int);   // OK more restrictive
   };
};