note 100905 deleted from language.oop5.properties by danbrown
| From: | danbrown@php.net | Date: | Sun, 14 Nov 2010 16:01:30 +0000 |
| Subject: | note 100905 deleted from language.oop5.properties by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174022@lists.php.net to get a copy of this message | ||
Note Submitter: Mohammad Afghari
----
your class can extends this class
abstract class Object
{
private $values;
public function __get($name)
{
$method=$method = 'get_'.$name;
if (method_exists($this,$method))
{
return $this->$method();
}
else return $this->values[$name];
}
public function __set($name, $value)
{
$method=$method = 'set_'.$name;
if (method_exists($this,$method))
{
$this->$method($value);
}
else $this->values[$name]=$value;
}
}
Is there any bug?