PHP - Inheritance and Polymorphism
Consider this PHP code:
What is the output?
class X {
public function foo() {
return "X";
}
}
class Y extends X {
public function foo() {
return "Y";
}
}
class Z extends Y {
public function foo() {
return parent::foo() . parent::foo();
}
}
$obj = new Z();
echo $obj->foo();What is the output?
