Re: Support for friend classes

From: Date: Wed, 11 Jan 2006 09:06:41 +0000
Subject: Re: Support for friend classes
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-21472@lists.php.net to get a copy of this message
Greg Beaver wrote:
By definition, if you're accessing it from another class, then perhaps it isn't "private" at all.
in C++ "friend" gives access to both "private" and "protected" ...
This can be more easily and intuitively solved by using protected and CoderTest extends Coder,
given that PHP doesn't have multiple inheritance this just doesn't work out all the time, so this would actually be an argument *for* "friend" in PHP
or just making it public and documenting in the code where it should and should not be used.
this argument can easily be extended to "don't use the PPP stuff at all" "friend" on the other hand is a mechanism to allow more fine grained access control "friend" extends PPP in a similar way as ACLs extend the unix file access control mechanisms "user/group/others" concept ... -- Hartmut Holzgraefe, Senior Support Engineer . MySQL AB, www.mysql.com

« previous php.internals (#21472) next »