Compiler Warning (level 4) C4623
Collapse the table of content
Expand the table of content
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. ArchiveDisclaimer

Compiler Warning (level 4) C4623

'derived class' : default constructor could not be generated because a base class default constructor is inaccessible

A constructor was not accessible in a base class and was therefore not generated for a derived class. Any attempt to create an object of this type on the stack will cause a compiler error.

This warning is off by default. See Compiler Warnings That Are Off by Default for more information.


The following sample generates C4623.

// C4623.cpp
// compile with: /W4
#pragma warning(default : 4623)
class B {

class C {

class D : public B {};   // C4623 make B's constructor public
class E : public C {};   // OK

int main() {
   // D d;  will cause an error
© 2016 Microsoft