复制代码 代码如下:
class Cart{
public function Cart(){
echo "正在调用Cart()
";
}
public function doSomething(){
echo "正在调用doSomethimg()
";
}
}
class Named_Cart extends Cart{
function Named_Cart(){
echo "正在调用Named_Cart()
";
}
function doSomething(){
echo "正在调用Named_Cart::doSomething()
";
}
}
$myCart=new Cart();
$myCart->doSomething();
$myNamed_Cart=new Named_Cart();
$myNamed_Cart->doSomething();
?>