On 8/25/05, Christian Schneider <[EMAIL PROTECTED]> wrote:
> Marian Kostadinov wrote:
> >   public getter fullName { // may also have ()
> >    return "{$this->firstName} {$this->lastName}";
> >   }
> >
> >   public setter fullName ($value) { // may also not have ($value) but
> > a special var.
> >    list ($this->firstName, $this->lastName) = explode (' ', $value, 2);
> >   }
> 
> This can be easily done with
> 
> function __get($name)
> {
>          $get = "get_$name";
> 
>          return $this->$get();
> }
> 
> function __set($name, $value)
> {
>          $set = "set_$name";
> 
>          $this->$set($value);
> }
> 
> in your base class (the function names are then get_fullName/set_fullName.
> 
> - Chris
> 

I know this solutions but it does not solve the property visibility
issues and good overloading rules like in common methods. Let's say
you have about 6-7 suche proterties which you expect to overload and
some of the are private e.t.c

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to