Does doing the following, create memory problems (new allocations without proper deletes) Assuming an object named "object"
class aClass
{
private:
object* myobject;
public:
aClass() : myobject(NULL) {};
~aClass()
{
if(myobject)
delete myobject;
myobject = NULL;
}
void myfuction()
{
if(myobject)
myobject = new object();
}
}
does calling myfunction() often create memory which is never released, or the fact that i create the variable and copy it to myobject is safe, because at the end the myobject gets deleted ?