Re: private properties ....

From: Date: Fri, 30 Nov 2007 12:06:20 +0000
Subject: Re: private properties ....
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-33544@lists.php.net to get a copy of this message
Hi Marco, On Fri, 2007-11-30 at 12:43 +0100, "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. Since PHP's object model is based n the class concept and these limitations are bound to the class, not the object. > 2. This doesnt works if cc is a own class with same property name (ie. > interface or something like this) cc is another class. > 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. That's a feature: Extended classes know nothing about private stuff in the parent class. Without that the encapsulation won't be complete. > Thats just some questions :) And some answers. johannes

« previous php.internals (#33544) next »