jeudi 29 août 2019

How to deallocate memory through delete with if statement in c++ [duplicate]

This question already has an answer here:

I have allocated memory to object using new, calling function through that object withing if statement then where should i use delete keyword?

class *obj =null;
obj = new class();
if(failed(obj->Add()))
{ 
    cout<<"function call failed"; 
}

Aucun commentaire:

Enregistrer un commentaire