🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1215

Re: Virtual base classes and mem initializers

#1215
From: John MAX Skaller
Date: Sat, 12 Dec 1992 15:14
38 lines
2384 bytes
In article <1992Dec11.165754.9910@Cadence.COM> cox@cadence.com (Henry Cox) writes:
>(I posted this last night - it did not appear on our systems, so I am
>posting it a second time.  I apologize for any duplication you see.)
>
>I ran into an interesting situation with respect to multiple
>inheritance and [initialising] virtual base classes.  

>Comments?  Suggestions?  
>
	Markku Sakkinen has written a paper on this issue, due to
appear in the C++ Report I believe. it is generally felt
that initialisation by the 'join' class should be used.
	Another idea I put forward was to use the name dominance
rule, but this would require the ctor initialisers to be part
of the interface.

	The real question is 'why am I initialising virtual bases',
and 'how do I explain that there are *different* initialisers'.
It should be that if a base is initialised at all, it is initialised
in only one way. This is enforced for single inheritance by
only allowing initialisation of direct bases, and for virtual bases
by insisting that the most derived class initialises them,
even if not direct bases, so any other initialisers are unfortunately
ignored.

	This phenomenon is extremely annoying when using mixins,
when all the abstract base classes are virtual, and the whole lot
have to be initialised in the most derived class.

	A general rule of thumb would appear to be that candidates
for shared base status should never require non-default initialisation,
since this is the only reasonable way to have unique initialisation.

-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
Technical Details
Message-ID: <1992Dec12.151420.28756@ucc.su.OZ.AU>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
References: <1992Dec11.165754.9910@Cadence.COM>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: Virtual base classes and mem initializers
Message-ID: <1992Dec12.151420.28756@ucc.su.OZ.AU>
Keywords: mem initializers, virtual base classes, multiple inheritance
Sender: news@ucc.su.OZ.AU
Nntp-Posting-Host: extro.ucc.su.oz.au
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
References: <1992Dec11.165754.9910@Cadence.COM>
Date: Sat, 12 Dec 1992 15:14:20 GMT
Lines: 38