"Incidentally, an object’s implicit constructor is always called before the
explicit one you define. When your explicit constructor starts to execute, your
object and all its subobjects already exist and have been initialized."
If your class has some ancestors and you don't explicitly call their constructors in the initializer list, those constructors will be called automatically, whatever you explicitly specify is called as you see it ( maintaining the call order required by the compiler )
eg:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
struct A
{
A( some arguments ); // base class constructor.
};
class B : public A
{
some_type member;
B ( some arguments ) :
A ( arguments ), // calls base constructor
member ( arguments ) // calls member constructor
{
// body of the constructor, at this point all the members and and ancestors of B are fully constructed
}
};
Same as above, without specifying the constructors:
6 7 8 9 10 11 12 13 14
class B : public A
{
some_type member;
B ( some arguments ) // no initializer list, A and member constructors default constructors are called implicitly
{
// body of the constructor, at this point all the members and and ancestors of B are fully constructed
}
};