課程
/后端開發(fā)
/PHP
/PHP進(jìn)階篇
定義繼承于Car的Truck類 是這樣寫?
2014-12-30
源自:PHP進(jìn)階篇 2-8
正在回答
是這樣寫的
class Truck extends Car{
????function speedUp(){
????????$this->speed +=60;
????????return $this->speed;
????}
}
舉報
輕松學(xué)習(xí)PHP中級課程,進(jìn)行全面了解,用PHP快速開發(fā)網(wǎng)站程序
5 回答class Truck extends Car{ public function speedUp(){ $this->speed=parent::speedUp()+50; } }
1 回答子類Truck中$this->speed是指向父類Car中的變量嗎
3 回答$car = new Car(); 什么意思
1 回答為什么$car = new Car();這行會報錯?
4 回答<?php class Car { private function __construct(){ echo 'object creat'; } private static $_object = null; public static function getInstance(){ if(empty(self::$_object)){ self::$object = new Car(); }
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2014-12-31
是這樣寫的
class Truck extends Car{
????function speedUp(){
????????$this->speed +=60;
????????return $this->speed;
????}
}