Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!hellgate.utah.edu!cs.utexas.edu!usc!rutgers!mcnc!thorin!rhodopsin!coggins From: coggins@rhodopsin.cs.unc.edu (Dr. James Coggins) Newsgroups: comp.lang.c++ Subject: Re: are 'friend's really necessary ?? Message-ID: <12681@thorin.cs.unc.edu> Date: 17 Mar 90 22:22:44 GMT References: <169@pollux.kulcs.uucp> <133042@sun.Eng.Sun.COM> Sender: news@thorin.cs.unc.edu Reply-To: coggins@rhodopsin.cs.unc.edu (Dr. James Coggins) Organization: University Of North Carolina, Chapel Hill Lines: 27 In reply to the subject question, "No, but there are good reasons for having them." I don't like the friend examples where the reason for friend-ing is to permit commutative usage of operators. That strikes me as a syntactic cure for certain kinds of laziness, but on the other hand, such cures can sure be useful. A better example of friend classes arises in my COOL library where I have two classes that are separated for the purpose of isolating some highly changeable junk from the main class definition, which is pretty clean and understandable. I make the classes friends and create the junk class object in the constructor of the good class, providing a pointer to the good object so the junk object knows what good object it is associated with. That's the only pair of friend classes in my library, and I have no friend functions at all. --------------------------------------------------------------------- Dr. James M. Coggins coggins@cs.unc.edu Computer Science Department Questions: "How 'bout them HEELS?" UNC-Chapel Hill Correct response: Chapel Hill, NC 27599-3175 "How 'BOUT them Heels?" and NASA Center of Excellence in Space Data and Information Science ---------------------------------------------------------------------