编译器错误 C2776

每个属性只能指定一个“get”方法

你只能在 property 扩展属性中指定一个 get 函数。 指定多个 get 函数时,会发生此错误。

以下示例生成 C2776:

// C2776.cpp
struct A {
   __declspec(property(get=GetProp,get=GetPropToo))
   // try the following line instead
   // __declspec(property(get=GetProp))
      int prop;   // C2776
   int GetProp(void);
   int GetPropToo(void);
};