Hello Ole,
You found a good one. This wasn't documented, but it is a cint limitation.
If the base class has operator=, operator= is needed for derived classes.
It is possible to fix this, but before making commitment, I need to check
if there is side-effects.
For now, please provide operator= for THaRun also.
Thank you
Masaharu Goto
>
>Hi everyone,
>
>I am having a problem with operator= and CINT. I have a simple
>class that inherits from TNamed and has two protected data members,
>like so:
>
>class THaRun : public TNamed {
>
>protected:
> UInt_t fNumber; //Run number
> TString fFilename; //File name
>
>public:
> THaRun();
> THaRun( UInt_t number, const char* filename );
> THaRun( UInt_t number, const char* filename, const char* description );
> virtual ~THaRun();
> ...
>};
>
>I don't provide an explicit operator= because default memberwise
>assignment should be fine.
>
>Now, under CINT I try this:
>
>[1] THaRun r1(100,"/data/run100.dat","Run 100")
>[2] THaRun r2
>[3] r2 = r1
>(class TNamed)139424976
>
>Oops! If I now inspect the object r2, only the TNamed part has been copied
>and the data members of the THaRun part are zero/empty.
>
>If I compile these statements (Linux/egcs-1.1), it works as expected,
>i.e. "r2 = r1" copies all data members of THaRun.
>
>I am using ROOT 2.23/12 with CINT 5.14.25.
>
>Is this a limitation of CINT?
>
>Cheers,
>Ole
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:25 MET