Jochem Maas wrote: > Kiketom wrote: >> Hi all. >> Yesterday i have looking for the overloading members >> >> Member overloading >> void __set ( string name, mixed value ) >> mixed __get ( string name ) >> >> As an example i put this code: >> >> class foo >> { >> private $ID; >> private $Name; >> private $LastName; > > when you declare these three as 'real' members, __get() and __set() > will no longer be called - they are only called for non-existent members. > Nope, that's not true. If the members are private, or otherwise inaccessible, __get() and __set() are called - I've used this in a few places to provide a "read-only" member variable, e.g.: class foo { private $bar=0; public function __get($nm) { return $this->$nm; } public function __set($nm,$val) { if ($nm != 'bar') { $this->$nm = $val; } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php