Re: ClassDef

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Tue, 18 Sep 2007 15:30:06 +0200


Hi Alberto,

in principle non-TObject derived classes have the same abilities as TObject derived ones, as long as they have a ClassDef macro. I/O will be a tiny bit slower, you cannot store them in ROOT's collections - but that's it.

If your real-world objects all derive from TObject in the first inheritance chain then that's sufficient anyway; see e.g. TH1 where the TAttXYZ base classes do not derive from TObject either. But they still use ClassDef().

Cheers, Axel.

Alberto Pulvirenti wrote:
> Dear ROOTers,
>
> I have implemented a classe which has to be used as "base" for several
> further implementations.
> I was convinced that it had to inherit from TObject if I want to add it
> to the dictionary (and use ClassDef and ClassImp), then I did.
> Then, I implemented another class which inherited from TSelector and
> from my "base" class, and this caused several errors due to ambiguities
> whenever a TObject method was called, because both classes from which it
> inherited are derived from TObject.
>
> I thought that in principle my "base" class defines a simple operation,
> and it must never be stored into files or trees (it is a class which
> reads some data and converts them into another format).
> Then, to remove all these ambiguities, I thought: can I still use
> ClassDef and ClassImp when my class does NOT inherit from TObject? What
> kind of performance do I loose in this case? Should I also add or change
> somethind in the LinkDef line related to this class?
>
> Thanks a lot and best regards
>
> Alberto
>
>
Received on Tue Sep 18 2007 - 15:30:39 CEST

This archive was generated by hypermail 2.2.0 : Tue Sep 18 2007 - 17:50:01 CEST