Re: [ROOT] Delete Object

From: Frankland John (frankland@ganil.fr)
Date: Fri Jul 04 2003 - 07:00:01 MEST


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



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