If I have some object pointing to NULL
and i want to assign it using new
in the scope of a function, why is the lifetime of this object limited to the scope?
SomeObject *o = nullptr;
void f(SomeObject *o)
{
o = new SomeObject; //Not null
}
o->doWhatever(); //Null again
And: how can i assign someObject
else then (without returning)?