Hello Richard,

Friday, March 28, 2008, 6:27:24 PM, you wrote:
On 27/03/2008, Lokrain wrote:
Hello Internals,

This discussion was very interesting to me so I made some research about all
languages OOP.
Each time I saw definition of public, protected, private there was an
explanation which never
mentioned instances, but classes. I certainly thought that Richard is right

Surely it shouldn't work at all unless the $foo === $this?

I was even amazed that I haven't thought about this ever...and the
conclusion of my research
is that as, like Stanislav said, this keywords(public, etc) are for classes
not for instances...

I learned something new today :) Thanks for this discussion.

Best Regards, Dimitar Isusov
My confusion was that I assumed public/protected/private related to
instances and not classes. Whilst I accept that this is the way it is,
it doesn't FEEL right that one instance of class foo can call a
protected member of class bar because class bar extended class foo
along the way.
If they were static calls, that SORT of makes more sense to me.
I suppose this lack of understanding comes from only being self-taught.
Having learned all the theory behind helps a lot. And I agree when just
scimming over the OOP stuff you easily might get the impression that
dynamic means instance and static means class. But it really all is about
the class. Just think of it as you never provide a keyword to an instance
and all you want it to control which programmer is allowed to touch/use

Best regards,

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupphp-internals @
postedMar 28, '08 at 5:27p
activeMar 29, '08 at 12:05p



site design / logo © 2022 Grokbase