首页 > 其他 > 详细

温故而知新

时间:2016-11-04 23:44:37      阅读:327      评论:0      收藏:0      [点我收藏+]

技术分享

 

 1 <?php
 2 /**
 3  * User: szliugx@gmail.com
 4  * Date: 2016/11/4
 5  * Time: 21:53
 6  */
 7  
 8 class Atest
 9 {
10     public static $testnum = 0;
11     /**
12     A方法    
13     */
14     public function Afun()
15     {
16         self::$testnum += 2;
17         echo self::$testnum."<br/>";
18     }
19 }
20 
21 class Btest extends Atest
22 {
23     public static $testnum = 0;
24     /**
25     B方法    
26     */
27     public function Bfun()
28     {
29         echo parent::$testnum."<br/>";
30         echo self::$testnum."<br/>";
31     }
32 
33 }
34 
35 $atest = new Atest();
36 $atest->Afun();
37 $atest = new Atest();
38 $atest->Afun();
39 $btest = new Btest();
40 $btest->Bfun();

 

 

 

 

2

4

4

0

温故而知新

原文:http://www.cnblogs.com/liugx/p/6031839.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!