static and protection

Jarrett Billingsley kb3ctd2 at yahoo.com
Wed Mar 1 16:24:24 PST 2006


"Hasan Aljudy" <hasan.aljudy at gmail.com> wrote in message 
news:du56te$1rn5$1 at digitaldaemon.com...
> friendship works, my point was that it shouldn't be there in the first 
> place, it's not part of the OO paradigm, it's a hack introduced by C++

Just because it's not part of some archaic OO paradigm doesn't mean it can't 
exist.  It might be a hack, but I think it's kind of borne out of necessity. 
Sometimes the rules in OO need to be .. bent a little, and friend classes do 
just that.  I mean, which would you rather have?  Two classes that need to 
work together friended so they can access each others' internals, and so no 
one else can access those internals?  Or be required to make those internals 
public just so those classes can work together?  If two classes really need 
to work together but still need to be separate classes, I really don't see 
any other solution.. 





More information about the Digitalmars-d mailing list