virtual base class

From: Pasha Murat (murat@cdfsga.fnal.gov)
Date: Mon Oct 05 1998 - 17:02:49 MEST


Florian Schopper writes:
 > 
 > 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.
 > 

Hi Florian:  
	you're touching a serious issue which has been discussed a lot on this
list. In 2 words: an  interpreted class can't be derived from a compiled one 
because the virtual tables of the compiled classes are compiler-dependent.
This is where the things stand now.
						-pasha.



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