From -8936628356674746023
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8a4cd038fc33ea5a
X-Google-Attributes: gidf78e5,public
From: herbs@cntc.com (Herb Sutter)
Subject: Re: Ambiguous conversion due to private ba
Date: 1998/03/26
Message-ID: <3519c29f.2365671125@nr1.toronto.istar.net>#1/1
X-Deja-AN: 337819413
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
Content-Transfer-Encoding: 7bit
References: <3517FB6C.6DE8@central.beasys.com> <6f9nbr$sg5@engnews1.Eng.Sun.COM> <351994FE.15FB7483@pratique.fr>
X-Original-Date: Thu, 26 Mar 1998 02:55:53 GMT
Content-Type: text/plain; charset=us-ascii
Organization: iSTAR internet Incorporated
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANRoIfuEDnX0m9pzZAQFo7AF+I7kpi2g6EuupedAHBsztFVWQGTEgdeRo fRqHHVaTwPGP5/hPKcpr/BTjWHtwGz2k =P1Rh
Mime-Version: 1.0
Newsgroups: comp.std.c++


Valentin Bonnard <bonnardv@pratique.fr> wrote:
>Steve Clamage wrote:
>> Thus, private inheritance fails any test of the IsA relationship.
>
>I would say that private inheritance is a private IsA relationship. 
>It means that only some trusted functions (member, friends) are 
>aware of the relationship, which may change in the future.

Even member functions can't use Base and Derived objects polymorphically.

Private inheritance is far closer to "has-a" membership than it is to
public inheritance. That's because private inheritance means
"is-implemented-in-terms-of" (not "is-a"), as does membership. Hence one
should always prefer membership unless private inheritance is really
necessary, which usually means: to access a protected member, to override
a virtual function, or to be constructed before base subobjects.

---
Herb Sutter (mailto:herbs@cntc.com)

Current Network Technologies Corp  2695 North Sheridan Way, Suite 150
www.cntc.com www.peerdirect.com    Mississauga Ontario Canada L5K 2N6
---
[ 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              ]



