2.2.2使用self访问父类中的函数

<?php
/**
* 2.2.2使用self访问父类中的函数
* @authors haidong (admin@zhe700.net)
* @date 2015-03-23 13:59:05
* @version $Id$
*/

class MyObject {

function myBaseMethod(){
echo "I am baseObject";
}
}
class MyExtendObject extends MyObject{
function myExtendMethod(){
echo "I am Extend Object ";
self::myBaseMethod();//调用父类中的函数
}
}
$instance = new MyExtendObject();
$instance->myExtendMethod();

posted @ 2015-03-23 14:20  我的代码  阅读(128)  评论(0编辑  收藏  举报