我不知道为什么此代码在PHP中不起作用?
<?php
interface Engine {
function run();
}
interface HydroEngine extends Engine {
function run();
}
interface Car {
function setEngine(Engine $engine);
}
interface WaterCar extends Car {
function setEngine(HydroEngine $engine);
}
?>
看来它没有违反任何OOP规则,但是为什么它给我一个错误?
Fatal error: Declaration of WaterCar::setEngine() must be compatible with Car::setEngine(Engine $engine)
汪汪一只猫
LEATH