Compiler Warning (level 4) C4623

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see Compiler Warning (level 4) C4623 on docs.microsoft.com. 'derived class' : default constructor was implicitly defined as deleted because a base class default constructor is inaccessible or deleted

A constructor was not accessible in a base class and was not generated for the 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 {  
   B();  
};  
  
class C {  
public:  
   C();  
};  
  
class D : public B {};   // C4623 - to fix, make B's constructor public  
class E : public C {};   // OK - class C constructor is public  
  
int main() {  
   // D d;  will cause an error  
}  

Show: