From -3308542794059870134
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,edd477ec92e5348f
X-Google-Attributes: gidf78e5,public
X-Google-Thread: fc772,ef0c226459c03bdf
X-Google-Attributes: gidfc772,public
From: "Bill Wade" <bill.wade@stoner.com>
Subject: Re: Protected Inheritance
Date: 1999/02/05
Message-ID: <79d2bd$fsf$1@uuneo.neosoft.com>#1/1
X-Deja-AN: 441110139
Approved: dom@devitto.demon.co.uk
Sender: cppmods@netlab.cs.rpi.edu
References: <Pine.GSO.3.95-960729.990131142619.5694B-100000@finan.ncl.ac.uk> <slrn7bbi9a.q1a.sbnaran@localhost.localdomain> <sUPt2.16333$202.8056314@news1.teleport.com> <79aesq$qlr$1@uuneo.neosoft.com> <HEbu2.18017$202.8772558@news1.teleport.com>
X-Submission-Address: c++-submit@netlab.cs.rpi.edu
X-Approved-For-Group: Fergus Henderson <fjh@cs.mu.oz.au> comp.std.c++
X-Original-Date: 05 Feb 99 07:05:54 GMT
Organization: NeoSoft, Inc.
X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUANrtQb0HMCo9UcraBAQED0QH8DV3q8khF2M+Z6WB5+k7enoVi57nJxHXA wheD4eeUWuplges3QU2ep1aiP3jZPQ67Ll4Z4siLcOWnXgDLWNESAw== =SPbX
Newsgroups: comp.lang.c++.moderated,comp.std.c++

Scott Meyers wrote in message ...
>  class Base {
>  public:
>    Base();
>  };
>
>  class Derived: private virtual Base {};
>
>  class MoreDerived: public Derived {};
>
>  MoreDerived m;

>The FDIS (and presumably the
>standard -- I really should buy a copy, shouldn't I?) addresses the
>matter
>in 12.6.2.  Paragraph 2 seems to back you up (I've omitted stuff that
>doesn't seem germane here):


Paragraph two talks about names, but not accessibility.  Paragraph six (in
the standard, I haven't checked FDIS) says for this case:

"[Base is] initialized by the constructor of [MoreDerived.] ... If [Base]
does not have an accessible default constructor, the initialization is ill
formed."

So I think this means that virtual base classes should never be private in a
class intended for derivation.  Note that MoreDerived could be changed to be
legal:
  class MoreDerived: public Derived, private virtual Base {};
but the developer has to look at Derived's private stuff to figure this out.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




