abstract:<?php class Father { //静态属性 public static $money = 5000; //静态方法 public&n
<?php class Father { //静态属性 public static $money = 5000; //静态方法 public static function getClass() { //返回当前的类名 return __CLASS__; } //静态方法 public static function getMoney() { return static::getClass() . '=>' . static::$money; } } class Son extends Father { public static $money = 3000; public static function getClass() { return __CLASS__; } } //调用Father中的静态方法,来获取类名 echo Father::getClass(), '<br>'; echo Father::getMoney(), '<br>'; //调用子类Son中的静态成员 echo Son::$money, '<br>'; echo Son::getClass(), '<br>'; echo '<hr>'; //子类中调用父类中的getMoney echo Son::getMoney(), '<br>';
Correcting teacher:天蓬老师Correction time:2019-04-19 13:39:53
Teacher's summary:后期绑定, 提供一种在静态继承上下文环境中, 可以准确的知道类成员的调用者的手段...