Problem Statement
What is method overriding in PHP?
Explanation
Method overriding means redefining a parent class method inside a child class with the same name and parameters. The child version replaces the parent one when called from the child object.
Code Solution
SolutionRead Only
class ParentClass { function greet(){ echo 'Hi'; } }
class Child extends ParentClass { function greet(){ echo 'Hello'; } }