This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c++ virtual base classes


That's correct and is just the way C++ is defined. Generally you
shouldn't have data in such base classes and, if this is the case, you
shouldn't have any problems. To bring us back to the topic of egcs,
you might note that g++ supports an extension to C++ called signatures
( http://egcs.cygnus.com/onlinedocs/gcc_5.html#SEC113 ) that might do
what you want as long as you don't need data in this "base class". If
you think you do then you need to revisit your design most likely. Of
course, I recommend that people don't use non-standard extensions to a
language like C++ but its available for you if you feel you need it.

	later,

		Ben Scherrey

flatmax wrote:
> 
> Yep - but there is no :
> static class VBase{};
> decleration allowed !!
> 
> Which means it can't be inherited and must be a static variable ... not
> really the best and perhaps overlooked by the specs. ?
> 
> On Thu, 8 Jul 1999, Benjamin Scherrey wrote:
> 
> > That's once per instance I believe not once globally as you would get
> > by using a static member (which is what I believe you really want). If
> > you had a multiple inheritance situation where VBase would be
> > inherited more than once, using virtual inheritance would ensure that
> > its ctor/dtor was called only once for that object instance, otherwise
> > it would be called as many times as it appeared in the inheritance
> > hierarchy and you would have multiple copies of its data members.
> >
> >       later,
> >
> >               Ben Scherrey


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]