T
tech
Hi, i have the following situation
class B
{
static B createBobj();
}
Class A
{
func()
{
m_obj = createobj();
}
B& m_obj;
};
Obviously doesn't compile so
In class A i want to hold a reference to an instance of class B
created by the
factory method createBObj. i can't initialise my reference member in
constructor as
class A needs to do some other initialisation before creating instance
of B.
So how to solve this problem?
class B
{
static B createBobj();
}
Class A
{
func()
{
m_obj = createobj();
}
B& m_obj;
};
Obviously doesn't compile so
In class A i want to hold a reference to an instance of class B
created by the
factory method createBObj. i can't initialise my reference member in
constructor as
class A needs to do some other initialisation before creating instance
of B.
So how to solve this problem?