Consider:
struct A {
int i;
int j;
A() : j(0), i(j) { }
};
Now i
is initialized to some unknown value, not zero.
Alternatively, the initialization of i
may have some side effects for which the order is important. E.g.
A(int n) : j(n++), i(n++) { }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…