Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.13 KB

compiler-warning-level-4-c4623.md

File metadata and controls

40 lines (31 loc) · 1.13 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 4) C4623
Compiler Warning (level 4) C4623
10/27/2022
C4623
C4623
e630d8d0-f6ea-469c-a74f-07b027587225

Compiler Warning (level 4) C4623

'derived class' : default constructor was implicitly defined as deleted

Because the default constructor is deleted or inaccessible in a base class, the compiler can't generate a default constructor for the derived class. Attempts to create an object of this type by using the default constructor (for example, in an array) cause a compiler error.

This warning is off by default. For more information, see Compiler warnings that are off by default.

Example

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;  // Error C2280
}