PHP - Inheritance and Polymorphism
What is the issue with the following PHP code snippet?
class Animal {}
class Cat extends Animal {}
function petAnimal(Animal $a) {
echo "Petting animal";
}
petAnimal('cat');What is the issue with the following PHP code snippet?
class Animal {}
class Cat extends Animal {}
function petAnimal(Animal $a) {
echo "Petting animal";
}
petAnimal('cat');15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions