There is only one way to initialize base class instances and non-static member variables and use a list of initializers.
If you do not specify a base or non-stationary member variable in the constructor initializer list, then this element or base will either be initialized by default (if the member / base is a non-POD class class or a non-POD array) or is left uninitialized otherwise.
After entering the constructor body, all bases or elements will be initialized or left uninitialized (i.e. they will have an undefined value). There is no way in the constructor to influence how they should be initialized.
You may be able to assign new values ββto the members in the constructor body, but it is not possible to assign const members or members of a class type that were made incoherent, and it is impossible to double-check the links.
For built-in types and some custom types, assignment in the constructor body can have the same effect as initialization with the same value in the list of initializers.
If you cannot name a member or base in the list of initializers, and this object is a reference, has a class type without an accessible default constructor declared by the user, const qualified and has a POD type or a POD class type or an array of a POD class containing const qualified member ( directly or indirectly), then the program is poorly formed.
CB Bailey Jan 04 2018-11-11T00: 00Z
source share