Does the order of base-class initializers and member variable initializers matter?
问题 Is the order of the initializers for a class' constructor significant? So say I have: class MyClass : BaseClass { int a, b, c; public: MyClass(int); } e.g. 1: MyClass::MyClass(int forBase) : a(7), b(14), c(28), BaseClass(forBase) { } e.g. 2: MyClass::MyClass(int forBase) : BaseClass(forBase), a(7), b(14), c(28) { } Would example 1 do something different to example 2? 回答1: Would example 1 do something different to example 2? No . Initialisation order is dictated by the standard, not by the