PHP - Inheritance and Polymorphism
Identify the error in this PHP code:
class ParentClass {
public function sayHi() {
echo "Hi from parent";
}
}
class ChildClass extends ParentClass {
public function sayHi() {
parent.sayHi();
echo " and child";
}
}
$obj = new ChildClass();
$obj->sayHi();