PHP - Inheritance and Polymorphism
Consider the following PHP classes:
What will be the output of:
class Vehicle {
function start() {
echo "Starting vehicle";
}
}
class Car extends Vehicle {
function start() {
echo "Starting car";
}
}
class ElectricCar extends Car {
function start() {
parent::start();
echo " silently";
}
}What will be the output of:
$ec = new ElectricCar(); $ec->start();
