Ok. I assume you're not talking about actual Behaviour 'actAs' Templates.
If you define a new __get() method, it will automatically override the parent's __get() method.
Now in your new __get() method, you first check if it exists in your current instance, and then the parent's.
I hacked this together (bear in mind, it's almost midnight):
<?php
class bar {
public $data = array();
public function __construct() {
$this->data['virtual_field'] = "set in bar";
}
public function __get($name) {
if(array_key_exists($name, $this->data)) {
return $this->data[$name];
}
return null;
}
public function __set($name, $value) {
$this->data[$name] = $value;
}
}
class foo extends bar {
public $data = array();
public function __construct() {
}
public function __get($name) {
if(array_key_exists($name, $this->data)) {
return $this->data[$name];
}
if (parent::__get($name))
return parent::__get($name);
return null;
}
public function __set($name, $value) {
$this->data[$name] = $value;
}
}
$a = new foo;
echo $a->virtual_field;
Now I dont know how well this works for what you are trying to achieve.