Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Compiler Error C2890

'class' : a ref class can only have one non-interface base class

A reference class can only have one base class.

The following sample generates C2890:

// C2890.cpp
// compile with: /clr /c
ref class A {};
ref class B {};
ref class C : public A, public B {};   // C2890
ref class D : public A {};   // OK

Managed Extensions for C++

The following sample generates C2890:

// C2890b.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
__gc class A {};
__gc class B {};

__gc class C : public A, public B {};   // C2890
__gc class D : public A {};   // OK
Show:
© 2015 Microsoft