<?php
/*
subclass
Extendable template class subclass
Enables Class Hierarchy without comprising structure
Requires: masterClass
*/
/*****************************************/
abstract class subclass{
protected $masterClass;
private $masterClassCon;
public function __construct(&$masterClassCon = ''){
if($masterClassCon != '') $this->masterClassCon = $masterClassCon;
}
public function __call($function, $arguments){
$class = $this->getInstance();
return call_user_func_array(array(&$class, $function), $arguments);
}
public function &__get($variable){
$class = $this->getInstance();
return $class->$variable;
}
public function __set($variable, $value){
$class = $this->getInstance();
$class->$variable = $value;
}
private function &getInstance(){
if(isset($this->masterClassCon)) return $this->masterClassCon;
$this->masterClassCon = new $this->masterClass();
return $this->masterClassCon;
}
}
?>
|