2.2.3使用parent作用域

 1 <?php
 2 /**
 3 * 2.2.3使用parent作用域
 4 * @authors haidong (admin@zhe700.net)
 5 * @date 2015-03-23 14:20:22
 6 * @version $Id$
 7 */
 8 
 9 class myObject {
10 
11 function myMethod(){
12 echo "this is myObject";
13 }
14 }
15 class myExtendObject extends myObject{
16 function myMethod(){
17 //添加一些新功能
18 echo "this is myExtendObject" . "<br/>";
19 //然后再调用myObject中定义的原来的myMethod方法
20 parent:: myMethod();
21 }
22 }
23 $instance =new myExtendObject();
24 $instance->myMethod();

原文地址:https://www.cnblogs.com/haidong/p/4359743.html