共用方式為


編譯器錯誤 C3265

無法在 Unmanaged 'Unmanaged 建構' 中宣告 Managed 'Managed 建構'

您無法在 Unmanaged 內容中包含 Managed 物件。

下列範例會重現 C3265:

// C3265_2.cpp
// compile with: /clr /LD
#include <vcclr.h>

ref class A { };

class B
// try the following line instead
// ref class B
{
   A ^a;   // C3265
   // or embed the managed handle using gcroot
   // try the following line instead
   // gcroot<A^> a;
};