I have a constructor that takes some arguments. I had assumed that they were constructed in the order listed, but in one case it appears they were being constructed in reverse resulting in an abort. When I reversed the arguments the program stopped aborting. This is an example of the syntax I'm using. The thing is, a_ needs to be initialized before b_ in this case. Can you guarantee the order of construction?
e.g.
class A
{
public:
A(OtherClass o, string x, int y) :
a_(o), b_(a_, x, y) { }
OtherClass a_;
AnotherClass b_;
};
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…