class hydra {
var $dbcon;
function __construct($ezSQL){
$this -> dbcon=$ezSQL;
}
}
class user extends hydra{
function foo(){
echo "bar is: ".$this->dbcon;
}
}
然后我打电话给:
$hydra = new hydra($ezSQL);
但是,此时我收到以下错误:
Fatal error: Cannot instantiate abstract class hydra
如何设置一个将继承所有子函数的类,以便我可以执行以下操作:
$hydra = new hydra("foobar");
$hydra -> foo();
输出:
酒吧是: foobar