From 2435890957784103973
X-Google-Thread: f78e5,f6130266038a8c4d
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news2.telebyte.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!proxad.net!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: SeeWebsiteForEmail@moderncppdesign.com ("Andrei Alexandrescu (See Website for Email)")
Newsgroups: comp.std.c++
Subject: Re: Private Methodes declared outside of the class
Date: Thu, 19 Aug 2004 04:00:12 GMT
Lines: 39
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <2oih41Fb5pb5U1@uni-berlin.de>
References: <2oblfaF8nds3U1@uni-berlin.de> <cfvuts$sen$1@news1nwk.SFbay.Sun.COM>
NNTP-Posting-Host: news.news.demon.net
X-Trace: news.demon.co.uk 1092888062 21167 158.152.254.254 (19 Aug 2004 04:01:02 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 19 Aug 2004 04:01:02 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-Priority: 3
X-Spam-Checker-Version: SpamAssassin 2.60-mulga_r1 (1.212-2003-09-23-exp) on 
	mulga.cs.mu.OZ.AU
X-Orig-X-Trace: news.uni-berlin.de j75eps9aoWiNmr2B8agJ4QAIhKMOiErxz8ibr4cyMGpGVRxg4=
X-Spam-Status: No, hits=-3.6 required=5.2 tests=AWL,BAYES_00,PRIORITY_NO_NAME 
	autolearn=no version=2.60-mulga_r1
X-RFC2646: Format=Flowed; Response
X-MSMail-Priority: Normal
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i7J40C3r009491;
	Thu, 19 Aug 2004 14:00:12 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:1831

"Steve Clamage" <stephen.clamage@sun.com> wrote in message 
news:cfvuts$sen$1@news1nwk.SFbay.Sun.COM...
> Ben Strasser wrote:
>>
>> I was wondering why you can not declare private methods outside of the 
>> class declaration?
>
> If you could declare member functions outside the class definition, anyone 
> could hijack the class (for good or bad purposes), or break the class 
> invariants without anyone knowing.

Well, not if they don't have access to the class' private parts. (I 
understand this is derailing the discussion from OP's post.)

> The existing rule means that the entire class interface is visible in the 
> class declaration, and you have a complete list of everything (members and 
> friends) that could be affected by an internal implementation change.
>
> This rule works against information hiding, but that was not a design goal 
> of C++ classes.

I think that was a reasonable design - to access the private part of a 
class, you'd need to touch the header in which the class was defined. Pretty 
neat.

What works against information hiding is that lookup precedes protection 
check. That arguably is a good thing, but in C++ you can't easily define a 
member function that's just totally "hidden".


Andrei 


---
[ 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                       ]



