virtual base class

Florian Schopper (fls@ipp-garching.mpg.de)
Mon, 5 Oct 1998 14:55:17 +0200 (MET DST)


Dear Rooters,

first of all, Cint is GREAT for testing hardware. It's so useful to be
able to call memberfunctions interactively and watch what happens at the
outputs.

-------------------------------------------------------
I have a problem with virtual base classes:

Everything works fine, when MAdc and MTrigger are derived from
MDaq WITHOUT virtual,

//****************************
class MDaq : public TObject
{ ........ClassDef(MDaq,0) }

class MAdc : public virtual MDaq
{ ........ClassDef(MAdc,0) }

class MTrigger : public virtual MDaq
{ ........ClassDef(MTrigger,0) }
//******************************

but as is, I get the compiler error:

MAdc_Cint.cxx: In function `class TBuffer & operator >>(class TBuffer &, class MAdc *&)':
MAdc_Cint.cxx:424: cannot cast up from virtual baseclass `MDaq'

Is the problem that there is only ONE TObject for several
derived classes? But to derive MAdc directly from TObject
additionally doesn't work either.

thanks,
Florian Schopper

----------------------------------------------------------------------
Florian Schopper office: Max-Plank-Institut fuer
extraterrestrische physik
Ludwig-Merk str. 3 Postfach 1603
80805 Muenchen Giessenbachstr.
phone: 49/89/3226157 Garching bei Muenchen

phone: 49/89/3299 3625
fax: 49/89/3299 3569
e-mail: fls@mpe-garching.mpg.de
http://wwwcn1.cern.ch/~fschoppe
----------------------------------------------------------------------
-----------------------------------------------------------------------