Re: Base class method

From: Victor Perevoztchikov (perev@bnl.gov)
Date: Fri Nov 26 1999 - 22:41:51 MET


Dear Masaharu,
> we could add something like TObjectGetname() in TNamed.

my example with TNamed & TObject was only an example.
Really I need to call Streamer for all classes inherited from TObject.
Thank you very much for proposal, but it will not help me.
Actually I tried to use CINT because I did not found ho to do it in plain
C++. The problem is how to call all Streamer(s) of arbitrary class inherited
from TObject via pointer. 
Anyway, thank you very much, I will try to find another way.

Victor


Masaharu Goto wrote:
> 
> Dear Victor,
> 
> As far as I can think, there is no fancy solution. As a workaround,
> we could add something like TObjectGetname() in TNamed.
> 
>   class TNamed : public TObject {
>     public:
>       ...
>       TString Getname() const;
>       TString TObjectGetname() const { return(TObject::Getname()); }
>       ...
>   };
> 
> Could this be your solution?
> 
> Thank you
> Masaharu Goto
> 
> >Dear Masaharu,
> >> Dictionary size is already too big. I think it is better not doing
> >> about change.
> >
> >I agree, that it is too much to increase already big dictionary.
> >I was asking really about workaround. But it is probably too complicated.
> >Actually I need it only for Streamer() but even for this only it is too much
> >
> >I tried to find workaround in C++ but also failed.
> >
> >In plain g++ i found
> >
> >   TNamed tm("AAA","BBB")
> >
> >   tm.TObject::Getname(); //gives "TNamed" which is correct
> >   but
> >
> >   char *(TNamed::gn)();
> >   gn = &TNamed::TObject::Getname;
> >   (tm.*gn)();             //gives "AAA"  which is wrong
> >
> >Thank you,
> >Victor

-- 
Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch       
Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:43 MET