abstract:<php //父類 class Father { //靜態(tài)屬性 public static $money = 100000; //靜態(tài)方法
<php //父類 class Father { //靜態(tài)屬性 public static $money = 100000; //靜態(tài)方法 public static function getClass() { //反回當(dāng)前類名 return __CLASS__; } // 靜態(tài)方法 public static function getMoney() { //return self::getClass().'::'.self::$money; return static::getClass().'::'.static::$money; } } //子類 class Son extends Father { //復(fù)寫父類的靜態(tài)屬性 public static $money = 500000; //靜態(tài)方法 public static function getClass() { return __CLASS__; } } //子類調(diào)用 echo Son::getClass();//Son echo '<hr>'; echo Son::getMoney();//Son::500000
?>
Correcting teacher:查無此人Correction time:2019-04-08 16:07:04
Teacher's summary:完成的不錯。php的類是個大知識點(diǎn),好好學(xué)習(xí),繼續(xù)加油。