From -7580903173079592054
X-Google-Thread: f78e5,6f042a6ff823c6a0
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: invalid@bigfoot.com (Bob Hairgrove)
Newsgroups: comp.std.c++
Subject: Re: Relation of enermy(anti-friend)
Date: Fri, 27 Aug 2004 02:38:02 GMT
Organization: Cablecom Newsserver
Lines: 67
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <42gsi09guhr518kkffinjpo5f5qaos07gl@4ax.com>
References: <cgk8od$vai$1@news.kreonet.re.kr>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1093574285 23406 158.152.254.254 (27 Aug 2004 02:38:05 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Fri, 27 Aug 2004 02:38:05 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Spam-Checker-Version: SpamAssassin 2.64-mulga_r1 (2004-01-11) on 
	mulga.cs.mu.OZ.AU
X-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham 
	version=2.64-mulga_r1
X-Path: comp-std-cpp-robomod!not-for-mail
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i7R2c2An024009;
	Fri, 27 Aug 2004 12:38:02 +1000 (EST)
X-NNTP-Posting-Date: Thu, 26 Aug 2004 20:03:47 +0000 (UTC)
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: Forte Free Agent 1.93/32.576 English (American)
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:2223

On Thu, 26 Aug 2004 19:26:13 GMT, stkim@yujinrobot.com ("Kim,
Seungtai") wrote:

>May be it just funny question.
>
>The friend makes that a function or class can access to
>invisible memebers with particular right. It works well for
>operator <<, >>, etc.
>
>In this point, the question arises. Why there is no enemy relation.

This ("enemy") is actually the correct spelling, not "enermy".

>Enermy relation means that a class or a function even can not see
>the public member of a enermy class if they are tied with enermy
>relation.
>
>For example,
>
>    class X;
>    class Y;
>
>    class X
>    {
>        enermy class Y;
>
>        public:
>            X ( Y & ); // Ok: Y is normal relation class.
>    };
>
>    class Y
>    {
>        public:
>            Y( X & ) // Error: X designates the Y to enermy.
>    };
>
>
>I thinks that this kinds of relation are easily arised in real situation.
>
>Is there already consideration occured? If not, why this relation
>dose not considered in the Standard or...
>
>Any comments. Thanks.

I think "public" should really mean "available for everyone". Limiting
access to class members can be done by other means, for example making
all members private and listing only those classes as friends which
are allowed to access the data. Or you can use a common base class and
make the otherwise "public" members "protected". Or using anonymous
namespaces, nested classes, etc.

Once something is declared "public", however, there is no turning
back. And I believe it is a good thing because it makes you think
about your classes' designs a bit more.

(just IMHO)

--
Bob Hairgrove
NoSpamPlease@Home.com

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



