Hi Thomas, In the statement new (a[2]) myClass that you must use to enter a new object in a TClonesArray, the operator "new with placement" is used. a[2] is used as an input parameter returning the pointer to a possible existing object at this slot. If an object already exists, the new operator does not allocate a new block of memory. The Myclass constructor will simply overwrite the previous object definition at this address. If the pointer a[2] is null, this special new operator allocates space for a new object that you can later retrieve via a[2]. Rene Brun Thomas Bretz wrote: > > Hello all, > > I found in the description of TClonesArray the following statement about > the index-operator: > > This operator should not be used for > lefthand side assignments, like a[2] = xxx. Only like, > new (a[2]) myClass, or xxx = a[2]. > > Whats the differents between > a[2] = new myClass and > new (a[2] myClass? > > Thanks, > Thomas.
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:40 MET