PHP - Inheritance and Polymorphism
What is wrong with this PHP code?
class Bird {
public function fly() {
return "Flying";
}
}
class Penguin extends Bird {
public function fly() {
echo "Penguins can't fly!";
}
}
$penguin = new Penguin();
echo $penguin->fly();