Why should constructors initialize bases and members in the member-initializer list instead of assigning in the body, and which subobjects require it?
Show answer and explanation
Every base and non-static data member is initialized before the constructor body runs. A member omitted from the member-initializer list uses its default member initializer when present, otherwise it is default-initialized. Assigning in the body therefore does not initialize that subobject; it first requires a valid initial state and then performs a separate assignment. References, const members, base classes without a usable default constructor, and members without a usable default constructor must receive the required initializer before the body. Direct initialization also avoids unnecessary default construction plus assignment and makes the object's invariant visible. Actual order is fixed by the language—virtual bases, direct bases, then members in declaration order—not by textual order in the list. This member-initializer syntax is distinct from the std::initializer_list type and from list initialization with braces.
Every base and non-static data member is initialized before the constructor body runs. A member omitted from the member-initializer list uses its default member initializer when present, otherwise it is default-initialized. Assigning in the body therefore does not initialize that subobject; it first requires a valid initial state and then performs a separate assignment. References, const members, base classes without a usable default constructor, and members without a usable default constructor must receive the required initializer before the body. Direct initialization also avoids unnecessary default construction plus assignment and makes the object's invariant visible. Actual order is fixed by the language—virtual bases, direct bases, then members in declaration order—not by textual order in the list. This member-initializer syntax is distinct from the std::initializer_list type and from list initialization with braces.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.