Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: How is method overriding achieved in PHP?
Answer: Method overriding occurs when a child class provides a specific implementation for a method that is already defined in its parent class.

Example:

class Animal {
 public function makeSound() {
 echo 'Generic Animal Sound'; 



class Dog extends Animal { 
public function makeSound() {
 echo 'Bark'; 

}
Is it helpful? Yes No

Most helpful rated by users:

©2026 WithoutBook