delete an object pointer of a class