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