Re: Inconsistencies when accessing protected members
| From: | Alexey Zakhlestin | Date: | Wed, 26 Mar 2008 17:05:12 +0000 |
| Subject: | Re: Inconsistencies when accessing protected members | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-36551@lists.php.net to get a copy of this message | ||
On 3/26/08, Richard Quadling <rquadling@googlemail.com> wrote:
> It just doesn't seem right to be able to call a private or protected
> method of another instance. Sort of isn't private any more.
> And as for being able to call a protected method of a completely
> different class, just because it shares the same ancestry. That seems
> REALLY wrong.
it is needed for operations on several instances of the same class-hierarchy.
"private" means, that you are the author of the class and you know
what you are doing with instances of this class, but you do not want
to export that inner-functionality.
use case for "protected" is similiar, but relates to cases when you
have hierarchy of classes, which still have some common functionality,
which might be usable for multi-instance operations
--
Alexey Zakhlestin
http://blog.milkfarmsoft.com/