编译器错误 C3816

“declaration”以前是用不同的托管或 WinRT 修饰符声明或定义的

前向声明和实际声明要求特性声明中不存在任何冲突或不一致。

下面的示例生成 C3816,并演示如何修复此错误:

// C3816a.cpp
// compile with: /clr /c
class C1;
// try the following line instead
// ref class C1;

ref class C1{  // C3816, forward declaration does not use ref
};