parent

<?php 
class MyObject {
function myMethod() {
//标准功能
echo "Standard Functionality\n";
}
}
class MyOtherObject extends MyObject {
function myMethod() {
//添加一些新功能
echo "New Functionality\n";
//然后再调用MyObject中定义的原来的myMethod方法
parent::myMethod();
}
}
$obj = new MyotherObject();
$obj->myMethod(); //New Functionality Standard Functionality

你可能感兴趣的:(r)