From -3335341535176650473
X-Google-Thread: f78e5,6f042a6ff823c6a0
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news2.google.com!proxad.net!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: stephen.clamage@sun.com (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: Relation of enermy(anti-friend)
Date: Sat, 28 Aug 2004 04:00:53 GMT
Organization: Sun Microsystems, Inc.
Lines: 39
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <cgnm0m$80u$1@news1nwk.SFbay.Sun.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; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1093665657 6697 158.152.254.254 (28 Aug 2004 04:00:57 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Sat, 28 Aug 2004 04:00:57 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.4) Gecko/20040414
X-Spam-Checker-Version: SpamAssassin 2.64-mulga_r1 (2004-01-11) on 
	mulga.cs.mu.OZ.AU
X-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham 
	version=2.64-mulga_r1
X-Accept-Language: en-US, en
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 i7S40rW2000925;
	Sat, 28 Aug 2004 14:00:53 +1000 (EST)
X-NNTP-Posting-Date: Fri, 27 Aug 2004 16:03:34 +0000 (UTC)
X-Spam-Level: 
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-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:2267

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.
> 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.
> 

I think what you want is information hiding, since you use the word 
"invisible".

Access specifiers and friendship do not implement information hiding. 
Private class members are not invisible, for example. There merely 
cannot be accessed accidently.

If you want to hide information from other parts of the program, 
several C++ techniques are available, hinted at by other replies in 
this thread.

Occasionally someone asks for a feature to keep parts of a class 
hidden from some member functions, or to grant partial friendship. I 
think such a desire reflects a program organziation that is not 
factored properly. Too much unrelated functionality is crammed into 
one class. A set of cooperating classes is probably a better solution.

---
Steve Clamage, stephen.clamage@sun.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                       ]



