J
John Harrison
What are the rule concerning calling member functions from an initialiser
list? Suppose I have
class C : public B
{
public:
C() : x(), y(f()), z() {}
private:
Y f();
X x;
Y y;
Z z;
};
B, X, Y, Z are other classes.
What am I allowed to do in C::f()? Presumably I'm not allowed to access C::y
or C::z since they haven't been constructed yet, what about C::x, and what
about members of the base class B? Any other gotchas in this situation?
thanks,
john
list? Suppose I have
class C : public B
{
public:
C() : x(), y(f()), z() {}
private:
Y f();
X x;
Y y;
Z z;
};
B, X, Y, Z are other classes.
What am I allowed to do in C::f()? Presumably I'm not allowed to access C::y
or C::z since they haven't been constructed yet, what about C::x, and what
about members of the base class B? Any other gotchas in this situation?
thanks,
john