Re: svn: /phpdoc/en/trunk/language/oop5/ visibility.xml
| From: | Daniel Egeberg | Date: | Fri, 11 Jun 2010 09:40:54 +0000 |
| Subject: | Re: svn: /phpdoc/en/trunk/language/oop5/ visibility.xml | ||
| References: | 1 2 | Groups: | php.doc.cvs |
| Request: | Send a blank email to doc-cvs+get-6808@lists.php.net to get a copy of this message | ||
On Fri, Jun 11, 2010 at 11:16, Richard Quadling <rquadling@gmail.com> wrote:
> On 11 June 2010 09:55, Daniel Egeberg <degeberg@php.net> wrote:
>> degeberg Fri, 11 Jun 2010 08:55:34 +0000
>>
>> Revision:
>> http://svn.php.net/viewvc?view=revision&revision=300372
>>
>> Log:
>> Explained that it is possible accessing private and protected members of other instances of
>> the same object type.
>>
>> Changed paths:
>> U phpdoc/en/trunk/language/oop5/visibility.xml
>>
>> *snip*
>>
>> --
>> PHP Documentation Commits Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> That "smells" like a bug. Private not being private. Sort of isn't
> private anymore. I know that everyone in the company has a bank
> account, but I can't get to it just because I know how to read my own.
It is not a bug. Marking members as private or protected is to
encapsulate things and hide implementation details. When you are
inside the Test class, there is nothing to hide about Test's
implementation even though it's a different instance.
You'll find similar behavior in C# [1], Java [2] and likely other
languages as well.
[1] http://pastebin.com/mtkUD2fp
[2] http://pastebin.com/cTb9PTQq
--
Daniel Egeberg