Dear Victor, Sorry to disagree, but try the following if you will : root [0] TNamed vic("vic","Victor object") root [1] vic.Print() OBJ: TNamed vic Victor object root [2] vic.Delete() root [3] vic.Print() Error: Symbol vic is not defined in current scope FILE:(tmpfile) LINE:1 Error: Failed to evaluate vic.Print()Possible candidates are... filename line:size busy function type and name *** Interpreter error recovered *** And while you're at it, look at the description of the TObject::Delete method which you will find here : http://root.cern.ch/root/html/TObject.html#TObject:Delete All the best, John Victor Perevoztchikov wrote: > > for ROOT objects on the stack (pippo is made by MakeClass, so will > inherit > > from TSelector (??)) you can use the Delete method, i.e. you can do > > The stack objects can not be deleted by user at all. They are deleted > automatically > by CINT or C++, when they are out of scope. > > Victor > Victor M. Perevoztchikov perev@bnl.gov <mailto:perev@bnl.gov> > Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000 > tel office : 631-344-7894; fax 631-344-4206; > > ----- Original Message ----- > *From:* Frankland John <mailto:frankland@ganil.fr> > *To:* Kurt Rinnert <mailto:rinnert@ekp.physik.uni-karlsruhe.de> > *Cc:* Attilio Santocchia <mailto:attilio.santocchia@pg.infn.it> ; > roottalk@pcroot.cern.ch <mailto:roottalk@pcroot.cern.ch> > *Sent:* Friday, July 04, 2003 1:00 AM > *Subject:* Re: [ROOT] Delete Object > > Hi Attilio and Kurt > > for ROOT objects on the stack (pippo is made by MakeClass, so will > inherit > from TSelector (??)) you can use the Delete method, i.e. you can do > > pippo.Delete() > > Hope this helps > > John Frankland > > Kurt Rinnert wrote: > >>Hi Attilio, >> >>this is a C++ issue: by doing >> >>root [6] pippo ppp >> >>you are creating the object on the stack. It will be destroyed >>automatically when it goes out of scope (at least in compiled code...). >> >>Operator delete works on pointers to objects you created on the heap >>with operator new, i.e. >> >>root [6] pippo* ppp = new pippo() >>root [7] delete ppp >> >>works. >> >>cheers, >> Kurt >> >>On Thu, Jul 03, 2003 at 11:02:14AM +0200, Attilio Santocchia wrote: >> >> >>>Hello Everybody >>>very simple question: >>>I have a tree named h1100 >>>I got an error when I try to delete an oblect using the folling command: >>> >>>root [4] h1100->MakeClass("pippo") >>>Info in <TTreePlayer::MakeClass>: Files: pippo.h and pippo.C generated from >>>Tree: h1100 >>>(Int_t)0 >>>root [5] .L pippo.C >>>root [6] pippo ppp >>>root [7] delete ppp >>>Error: ppp cannot delete FILE:/tmp/fileMKp30F_cint LINE:1 >>>*** Interpreter error recovered *** >>>root [8] >>> >>>What's the right command to delete the ppp object of the class pippo? >>> >>>Cheers >>> >>>Attilio >>> >>> >> >> >> > > >-- >John D. Frankland >Beam Coordinator >GANIL >B.P. 55027 >14076 CAEN Cedex 05 > >tel: +33 (0)231454628 >fax: +33 (0)231454665 > > > -- ganil logo <http://www.ganil.fr> John D. Frankland <mailto:frankland@ganil.fr> Beam Coordinator GANIL B.P. 55027 14076 CAEN Cedex 05 *tel:* +33 (0)231454628 *fax:* +33 (0)231454665
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET