0

考虑以下代码:

ref class ClassA
{

};

interface class IClassA
{
     void DoSomething(ClassA^ a);
};

使用 Visual C++ 11 Developer Preview 编译此代码会产生以下错误:

error C3981: 'IClassA::DoSomething' cannot be emitted into metadata

如果ClassA是公开的,则代码编译不会出错。ClassA如果是非公开的,为什么代码不能编译?

4

1 回答 1

0

This was a bug in the C++ compiler in the Visual Studio 11 Developer Preview.

The bug has been fixed and the code compiles without error using the Visual Studio 11 Beta.

于 2012-03-09T01:57:54.697 回答