Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!ulysses!hector!jss From: jss@hector.UUCP (Jerry Schwarz) Newsgroups: comp.lang.c++ Subject: Re: Friend specifier considered harmful Message-ID: <10587@ulysses.homer.nj.att.com> Date: 8 Sep 88 20:40:28 GMT References: <61@cybaswan.UUCP> <8160@alice.UUCP> <29433@bbn.COM> Sender: netnews@ulysses.homer.nj.att.com Reply-To: jss@hector.UUCP (Jerry Schwarz) Organization: AT&T Bell Laboratories Lines: 21 My perspective on "friends" is that they are another C++ mechanism for creating a public interface to a class. As such, the considerations that go into deciding whether to declare a friend are essentially the same as those that go into deciding whether to declare a public member. There are two import distinctions between member functions and friend functions. 1. Syntactic. Friends are invoked using ordinary function notation rather member (. or ->) syntax. Or in the case of friend operator, they may be invoked with the class object as the second operand. 2. A friend may be part of the interface of more than one class. Both 1 and 2 may play a part in deciding to use a friend rather than a member. Jerry Schwarz AT&T Bell Labs, Murray Hill