an**************@googlemail.com wrote:
Will _member be ever created before the initialization list in MyClass?
Am I guarantueed that it will only get created that once?
The initialization list is just a indication of the initializers that
are used when the appropriate initialization occurs. It has no bearing
on the order of initialization, regardless of the order of the
inializers in the list, or by their absence.
Construction always occurs in a definite order:
1. Any virtual base classes are initialized for the most derived object.
then
2. Recursively, the any non-virtual bases are initialized, in the
order they are declared in the class definition(i.e., after the
colon that follows the class name, NOT the member initializer list).
3. All non-static members are initialized in the order they are listed
in the class definition.
4. The body of the constructor is run.
All the initializer list does is say that when that constructor is used,
then those parameters are used to initialize the listed subobject when
the time for that initialization occurs as specified above.