Re: [ROOT] TObjArray::Delete() use private_object destructor or private_object Delete() function?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Nov 24 2003 - 19:13:13 MET


Hi Maria,

myArray->Delete() will call the destructor of the objects in the array.
You do not need a Delete function.
I suggest adding a print statement in your destructor to follow what happens.

Rene Brun


Maria Jesus Mora-Corral wrote:
> 
> Hi rooters,
> 
> I am using a TObArray "myArray" where I store my objects "myObject" of a
> class done by myself.
> I fill the TObjArray with the function AddAt and when I delete it I use
> 
> myArray->Delete() ;
> delete myArray ;
> 
> the member function Delete() is suppose to remove all objects from the
> array AND delete all heap based objects.
> But I am not sure if the function call the destructor of my object
> "myObject" or the Delete() member function.
> 
> For the moment, there is a destructor defined in my class but not a
> Delete function and this is may be given me memory problems.
> 
> Thanks in advance
> 
> Maria Mora



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET