Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36676 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7934 invoked from network); 29 Mar 2008 12:05:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Mar 2008 12:05:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:40881] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6B/38-53970-E703EE74 for ; Sat, 29 Mar 2008 07:05:19 -0500 Received: from MBOERGER-ZRH (p50867B15.dip.t-dialin.net [80.134.123.21]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id E10B911DB4D; Sat, 29 Mar 2008 13:05:14 +0100 (CET) Date: Sat, 29 Mar 2008 13:05:03 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <595483963.20080329130503@marcus-boerger.de> To: "Richard Quadling" CC: Lokrain , ceo@l-i-e.com, "Felipe Pena" , "Robin Fernandes" , In-Reply-To: <10845a340803281027t28a479afoca2ce7968c3329d3@mail.gmail.com> References: <10845a340803281027t28a479afoca2ce7968c3329d3@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Richard's lack of understanding of instances vs classes. From: helly@php.net (Marcus Boerger) 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 >> 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. 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 what. Best regards, Marcus