Re: [ROOT] Can't Clone my class

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Apr 09 2001 - 12:10:15 MEST


Hi Miha,

Cloning an object (TObject *obj) is done via obj->Clone().
This function creates a new object of your class by calling
its default constructor, then calls the Streamer function of your class to 
copy the members.

You must make sure that your constructor initializes correctly all members, in
particular the pointers. In your case, one of the pointers fCTFoonc,
fTFoonc, fLst or fMoother is probably not set. Check also the constructor
of your class TFoonction for similar symptoms.

Rene Brun

miha.puc@marvin.fmf.uni-lj.si wrote:
> 
> Hi!
> I'm new to roottalk.
> So can anybody help me?
> I wrote a class having the following data members:
> 
> class TFoonction : public TNamed {
> protected:
>    Int_t fNprs;
>    Int_t fMyIdx;
>    Int_t fMyIdxGlobal;
>    Double_t fXmin, fXmax;
>    TF1 *fCTFoonc;
>    TF1 *fTFoonc;
>    TList *fLst;
>    TFoonction* fMoother;
> 
> If I try to clone an object of this class I get a segfault.
> I rely on rootcint to generate the Streamer function.
> I only tried if with compiled code. I use ROOT v 3.00/06 RH Linux 6.2.
> 
> Miha
> --



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:41 MET