Hi Simon, In general, Use the form delete inheritedclass; If your class is a ROOT collection, like TList, TObjArray, you can do: mycollection->Delete(); //to delete all objects in the collection; delete mycollection; // to delete the empty collection. Note that if the collection has been declared to be the owner with mycollection->SetOwner(); it is sufficient to do: delete mycollection; //all owned objects will be automatically deleted. See also the chapter on Object Ownership in the Users Guide. Rene Brun Simon Dean wrote: > > Hi there, > > Could someone please explain to me the subtle nuances of destructors in > classes which inherit from TObject? I'm having problems with crashes > caused by such destructors, although I think the problem may be due to > delete statements inside them which refer to other classes that inherit > from TObject. > > What is TObject->Delete() and what is it used for? Would I do: > > delete inheritedclass > or > inheritedclass->Delete() > > for cleaning up memory. > > cheers, > > Simon
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:47 MET