PHP - Inheritance and Polymorphism
Given the code below, what will be the output?
class Vehicle {}
class Car extends Vehicle {}
function startEngine(Vehicle $v) {
echo get_class($v);
}
$car = new Car();
startEngine($car);Given the code below, what will be the output?
class Vehicle {}
class Car extends Vehicle {}
function startEngine(Vehicle $v) {
echo get_class($v);
}
$car = new Car();
startEngine($car);15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions