PHP - Inheritance and Polymorphism
What will be the output of this PHP code?
class ParentClass {
protected function greet() {
return "Hello from Parent";
}
}
class ChildClass extends ParentClass {
public function greet() {
return parent::greet() . " and Child";
}
}
$child = new ChildClass();
echo $child->greet();