<?php class Car { private $speed = 0; public function getSpeed() { return $this->speed; } protected function speedUp() { $this->speed += 10; } //增加start方法,使他能夠調用受保護的方法speedUp實現加速10 public function start() { //訪問函數也需要$this來調用 同c+
<?php class Car { private $speed = 0; public function getSpeed() { return $this->speed; } protected function speedUp() { $this->speed += 10; } //增加start方法,使他能夠調用受保護的方法speedUp實現加速10 public function start() { //訪問函數也需要$this來調用 同c+
2014-07-12
舉報