How keep constructor from being called till "ready"?
I know that if you do:
Code:
TestClass c;
TestClass c = NULL;
In both cases, TestClass' empty constructor is called. But I want to declare that a class has that variable but not call the constructor until the owning class' constructor is called.
Example:
Code:
class Owner
{
protected:
//Want this but not initialized!
TestClass t;
public:
Owner()
{
t = TestClass();
}
Owner(string name)
{
t = TestClass( name );
}
};
How would I do this (i.e. keep "t" from being initialized)?