J
Joost Ronkes Agerbeek
Are member objects constructed before the body of the constructor executes?
Consider the following example. Is this okay or is it possible that _bar
will be created after the call to DoBar()?
class Bar
{
public:
Set(int i) { _i = i; }
private:
int _i;
};
class Foo
{
public:
Foo() { DoBar(); }
private:
void DoBar() { _bar.Set(10); }
Bar _bar;
};
Thanks in advance,
Joost
Consider the following example. Is this okay or is it possible that _bar
will be created after the call to DoBar()?
class Bar
{
public:
Set(int i) { _i = i; }
private:
int _i;
};
class Foo
{
public:
Foo() { DoBar(); }
private:
void DoBar() { _bar.Set(10); }
Bar _bar;
};
Thanks in advance,
Joost