I have a class with some constant pointers to objects. What is the sequence of execution of the const value constructors and when are they assigned? This may make more sense looking at the following code.
class Foo
{
public:
Child2* const m_Child2;
Child1* const m_Child1;
Foo() :
m_Child1(new Child1(*this)),
m_Child2(new Child2(*this))
{}
};
class Child2
{
public:
Child2(Foo& Parent)
{
Parent.m_Child1;
// this value is still `nullptr` even though it should
// have been created before this constructor call
}
}
Is it possible for the constructor of Foo::m_Child2
to access the constructed object Foo::m_Child1
?