Hello, On 11/30/07, Marco Kaiser <[EMAIL PROTECTED]> 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