dimanche 2 janvier 2022

Static variables of class type don't use default initialization?

C++ Primer, Lippman et. al. 5th edition § 7.5.3 says,

The default constructor is used automatically whenever an object is default or value initialized. Default initialization happens When we define nonstatic variables (§ 2.2.1, p. 43) or arrays (§3.5.1, p. 114) at block scope without initializers

Tried a test program. Static objects created from user defined class do call default constructors in my test program.

Not able to understand why that (highlighted) statement then ?

Aucun commentaire:

Enregistrer un commentaire