From 1380045421184966653
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,7ba7148d601bc33d
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-07-21 08:07:33 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: richard@ex-parrot.com (Richard Smith)
Newsgroups: comp.std.c++
Subject: Re: Should class-member using declarations behave differently from
 namespace using declarations?
Date: Mon, 21 Jul 2003 15:07:32 +0000 (UTC)
Organization: Posted via Supernews, http://www.supernews.com
Lines: 39
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <Pine.LNX.4.55.0307211505560.8099@sphinx.mythic-beasts.com>
References: <EDA5B2A0-B6FF-11D7-9A62-000A959DF3B0@cs.stanford.edu>
 <8c8b368d.0307160458.7889773@posting.google.com> <NtkmfXBkQZF$Ew+v@robinton.demon.co.uk>
 <bf62sn$kel$1$830fa79d@news.demon.co.uk> <JTqHwMBSSHG$EwFb@robinton.demon.co.uk>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Trace: mail2news.demon.co.uk 1058800052 11168 10.0.0.1 (21 Jul 2003 15:07:32 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 21 Jul 2003 15:07:32 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 19ecGB-0002tz-00
	for mail2news@news.news.demon.net; Mon, 21 Jul 2003 15:07:32 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id BAA03753; Tue, 22 Jul 2003 01:07:28 +1000 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ucar.edu
X-Newsgroups: comp.std.c++
X-X-Sender: richard@sphinx.mythic-beasts.com
X-Spam-Status: No, hits=-4.6 required=5.0
	tests=AWL,BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,
	      REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_PINE
	autolearn=ham version=2.55
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
Xref: archiver1.google.com comp.std.c++:20238

Francis Glassborow wrote:

> No you are perfectly right however I am not convinced that it should be.

But it breaks encapsulation by allowing members of one class
access to the private members of another.

  class B {
    private: int x;
  };

  class D : public B {
    void f() { cout << x << endl; }
  };

This is an error:  x is a private member of B so can't be
accessed by D.  Now consider add a using declaration to D:

  class D : public B {
    private: using B::x;
    void f() { cout << x << endl; }
  };

Now the name x is a private member of D, which can be
accessed within D.

By allowing this you allow derived classes to access *any*
data member of a base class.  I think this would be a very
bad idea indeed.

--
Richard Smith

---
[ 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://www.jamesd.demon.co.uk/csc/faq.html                       ]



