Given the types
struct A
{
A(int);
};
struct B : A
{
int x;
B();
};
is there any impactful reason to prefer the call to the constructor of A
before the initialization of x
? By impactful I mean effect on the behavior on the program rather than "it's good/common practice to do so".
B::B() : A(10), x(5) { }
// can this difference affect the programs behavior somehow?
B::B() : x(5), A(10) { }
The standard doesn't seem to forbid or reason about this, so I assume reordering the mem-initializer-list is well defined.