<php //父类 class Father { //静态属性 public static $money = 100000; //静态方法 public static function getClass() { //反回当前类名 return __CLASS__; } // 静态方法 public static function getMoney() { //return self::getClass().'::'.self::$money; return static::getClass().'::'.static::$money; } } //子类 class Son extends Father { //复写父类的静态属性 public static $money = 500000; //静态方法 public static function getClass() { return __CLASS__; } } //子类调用 echo Son::getClass();//Son echo '<hr>'; echo Son::getMoney();//Son::500000
?>