Re: svn: /phpdoc/en/trunk/language/oop5/ visibility.xml

From: 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 [email protected] to get a copy of this message
On Fri, Jun 11, 2010 at 11:16, Richard Quadling <[email protected]> wrote:
> On 11 June 2010 09:55, Daniel Egeberg <[email protected]> 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


Thread (5 messages)

« previous php.doc.cvs (#6808) next »