<?php
class Car {
private static $speed = 1100;
public static function getSpeed() {
return self::$speed;
}
public static function speedUp() {
return self::$speed+=120;
}
}
class BigCar extends Car {
public static function start() {
parent::speedUp();
}
}
echo BigCar::start();
echo BigCar::getSpeed();
没写return。
class BigCar extends Car {
public static function start() {
return parent::speedUp();
}
}
为何两个输出都是1220
第二个不应该是1100吗?