PHP - Inheritance and Polymorphism
What will be the output of this PHP code?
class Animal {
public function sound() {
return "Animal sound";
}
}
class Dog extends Animal {
public function sound() {
return parent::sound() . " and Bark";
}
}
$pet = new Dog();
echo $pet->sound();