Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error C3628
Collapse the table of content
Expand the table of content

Compiler Error C3628

'base class' : managed classes only support public inheritance

An attempt was made to use a managed class as a private or protected base class. A managed class can only be used as a base class with public access.

The following sample generates C3628:

// 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:

// 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() {
}

Community Additions

ADD
Show:
© 2015 Microsoft