class base {
function __construct() {
}
function dispatch($action){
try{
$this->$action();
}catch( Exception $e ){
$this->errorAction($e->getMessage());
}
}
function errorAction($str=null){
echo "overridden";
}
}
class Front extends Base {
function __construct() {
}
function page() {
throw new Exception( 'Template error.' );
echo "page";
}
function errorAction($str=null){
echo "Front:".$str;
}
}
$f = new Front;
$f->dispatch("page");