共用方式為


編譯器錯誤 C2811

'type1' : 無法繼承自 'type2',ref 類別只能繼承自 ref 類別或介面類別

您嘗試使用 Unmanaged 類別做為 Managed 類別的基類。

下列範例會產生 C2811:

// C2811.cpp
// compile with: /clr /c
struct S{};
ref struct T {};
ref class C : public S {};   // C2811
ref class D : public T {};   // OK