属性声明只能在托管类型或 WinRT 类型的定义内出现
注解
property 只能在托管类型或 Windows 运行时类型中声明。 本机类型不支持 property 关键字。
示例
以下示例生成 C3813 并演示如何修复它:
// C3813.cpp
// compile by using: cl /c /clr C3813.cpp
class A
{
property int Int; // C3813
};
ref class B
{
property int Int; // OK - declared within managed type
};