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
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Warning (level 1) C4678

Error Message

base class 'base_type' is less accessible than 'derived_type'

A public type derives from a private type. If the public type is instantiated in a referenced assembly, members of the private base type will not be accessible.

C4678 is only reachable using /clr:oldSyntax. It is an error, using /clr, to have a base class that is less accessible that its derived class.

The following sample generates C4678:

// C4678.cpp
// compile with: /clr:oldSyntax /LD /W1
#using <mscorlib.dll>
private __gc struct privateG {
// try the following line instead
// public __gc struct privateG {
public:
   int i;
};

public __gc struct V: public privateG {   // C4678
public:
   int j;
};

Community Additions

ADD
Show:
© 2015 Microsoft