Re: Richard's lack of understanding of instances vs classes.

From: Date: Fri, 28 Mar 2008 17:27:24 +0000
Subject: Re: Richard's lack of understanding of instances vs classes.
Groups: php.internals 
Request: Send a blank email to internals+get-36658@lists.php.net to get a copy of this message
On 27/03/2008, Lokrain <lokrain@gmail.com> 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 > saying: > > > 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. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"

« previous php.internals (#36658) next »