Compiler Error C3628
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3628.
base class' : managed or WinRTclasses only support public inheritance
An attempt was made to use a managed or WinRT class as a private or protected base class. A managed or WinRT class can only be used as a base class with public access.
The following sample generates C3628 and shows how to fix it:
// C3628a.cpp
// compile with: /clr
ref class B {
};
ref class D : private B { // C3628
// The following line resolves the error.
// ref class D : public B {
};
int main() {
}
The following sample generates C3628 and shows how to fix it:
// C3628b.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
__gc class B {
};
__gc class D : B { // C3628, private is the default access level
// The following line resolves the error.
// __gc class D : public B {
};
int main() {
}
Show: