Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 1.03 KB

compiler-warning-level-3-c4534.md

File metadata and controls

34 lines (28 loc) · 1.03 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 3) C4534
Compiler Warning (level 3) C4534
11/04/2016
c4534
C4534
ec2adf3b-d7a1-4005-bb0c-5d219df78dc8

Compiler Warning (level 3) C4534

'constructor' will not be a default constructor for class 'class' due to the default argument

An unmanaged class can have a constructor with parameters that have default values and the compiler will use this as the default constructor. A class marked with the value keyword will not use a constructor with default values for its parameters as a default constructor.

For more information, see Classes and Structs.

The following sample generates C4534:

// C4534.cpp
// compile with: /W3 /clr /WX
value class MyClass {
public:
   int ii;
   MyClass(int i = 9) {   // C4534, will not be the default constructor
      i++;
   }
};

int main() {
   MyClass ^ xx = gcnew MyClass;
   xx->ii = 0;
}