Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33545 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94012 invoked by uid 1010); 30 Nov 2007 14:08:37 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 93996 invoked from network); 30 Nov 2007 14:08:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Nov 2007 14:08:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.170.186 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 64.233.170.186 rn-out-0910.google.com Linux 2.4/2.6 Received: from [64.233.170.186] ([64.233.170.186:60206] helo=rn-out-0102.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/52-07727-26910574 for ; Fri, 30 Nov 2007 09:08:35 -0500 Received: by rn-out-0102.google.com with SMTP id e5so2191994rng for ; Fri, 30 Nov 2007 06:08:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; bh=xYkZKNzBiDT0gGzs+OzXkJ2kvjMzadv0xGKUlkNznig=; b=j22+1A4vPq6UUp+b3G2BGLA3kTZy7Imi2n9JPblI+VgIgbB6b0n4uuXoH+sQeGtYEXY8c+DamM6oKNgRwmd012w5IqpBrGj9/qFVY8g0hn8Cx1eSfBK/PfGbElA5/1abpPlJNnfPIvuiSOqw5ZU7TjGrwvX4cwLxBnsduGxIgSw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=dUooHW+wGymuUP3xDPW/T+1XyByfYzHDDUzcgariZ3jkqoD/SUZ/kbGFowmxClHE32xqGcjfvO9YNeS3JDfYYmNu4o/cf1/7wVQmLMqv9gZA68bP6iJZGLY0ZlBUEbzTd1D8UzyuVBRcyW2Q+ztsSTsiGOWeXK/2oAcSFS8O1yo= Received: by 10.70.19.20 with SMTP id 20mr5070457wxs.1196431709864; Fri, 30 Nov 2007 06:08:29 -0800 (PST) Received: by 10.70.41.7 with HTTP; Fri, 30 Nov 2007 06:08:29 -0800 (PST) Message-ID: Date: Fri, 30 Nov 2007 15:08:29 +0100 Sender: ekneuss@gmail.com To: "Marco Kaiser" Cc: internals@lists.php.net In-Reply-To: <474ff865.0d135e0a.4536.ffffa229@mx.google.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_414_16632080.1196431709854" References: <474ff865.0d135e0a.4536.ffffa229@mx.google.com> X-Google-Sender-Auth: fa5a216193bab5b5 Subject: Re: [PHP-DEV] private properties .... From: colder@php.net ("Etienne Kneuss") ------=_Part_414_16632080.1196431709854 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, On 11/30/07, Marco Kaiser wrote: > > Conclusion: > 1. Why i can access a private property from a different class instance > (name) but same type ? > $aa and $bb are instances of aaa but not the same. > 2. This doesnt works if cc is a own class with same property name (ie. > interface or something like this) The check whether a class property/method is accessible is based on the class of the scope you're in. It's not based on the instance. Note that encapsulation is still conserved as private properties are accessible only from methods of the class they're defined in. It also allows you to work with static methods that access private properties. 3. Is it a bug that i can't use same property name in my child class? > (normaly the parent property isnt visible to the child) > cc extends aaa. I'm not sure what you mean. As you can do: class A { private $foo = 2; } class B extends A { private $foo = 3; public function foo() { echo $this->foo; } } $b = new B; $b->foo(); // 3 Thats just some questions :) > > -- Marco > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal ------=_Part_414_16632080.1196431709854--