Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10471 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78264 invoked by uid 1010); 15 Jun 2004 14:40:42 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 78210 invoked from network); 15 Jun 2004 14:40:42 -0000 Received: from unknown (HELO main.gmane.org) (80.91.224.249) by pb1.pair.com with SMTP; 15 Jun 2004 14:40:42 -0000 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BaF76-0005sc-00 for ; Tue, 15 Jun 2004 16:40:41 +0200 Received: from 81.255.48.169 ([81.255.48.169]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Jun 2004 16:40:36 +0200 Received: from gmane-news by 81.255.48.169 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Jun 2004 16:40:36 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: internals@lists.php.net Date: Tue, 15 Jun 2004 16:35:06 +0200 Lines: 19 Message-ID: References: <20040615175918.57e77cbb.tony2001@phpclub.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 81.255.48.169 User-Agent: Mozilla Thunderbird 0.6 (X11/20040612) X-Accept-Language: en-us, en In-Reply-To: <20040615175918.57e77cbb.tony2001@phpclub.net> Sender: news Subject: Re: [PHP-DEV] Weird behaviour of private attribute + overloaded method From: gmane-news@dreams4net.com (Eric Daspet) Antony Dovgal wrote: > It outputs 'bool(false)', while I expect it to print 'int(123)'. Foo::id is private so Bar::setId() cannot use it. It uses an implicit public Bar::id (different from Foo::id). Foo::getId() correctly read the private attribute Foo::id (not the public Bar::id) and return it. > Am I missing something and this is really expected behaviour ? I think it is. - if we allow Bar::setId() to change Foo::id, "private" keyword is useless - if we allow Foo::getId() to read Bar::id instead of Foo:id, then a derived class can pertubate private things in the mother class (which is not a good solution). -- Eric Daspet