If a member object data
does not appear in the constructor's initialization list, then data
is constructed by its default constructor.
If data
appears in the constructor's initialization list, then it is simply initialized to the given value. Does this imply that there is no constructor call for creating data
? How is the new object data
constructed then?
If data appears in the constructor's initialization list, then it is simply initialized to the given value.
No, it is initialised using whatever arguments are supplied. If it has a class type, then the arguments are passed to a suitable constructor.
Does this imply that there is no constructor call for creating data?
No. If it has a class type, then initialisation is done by calling a constructor.