Polymorphism in PHP- Tutorialpath

PHP Polymorphism
PHP Polymorphism

This word is can (from the Greek meaning “having multiple forms”) poly and morphism.

Poly means “many” and morphism means property which help us to assign more than one property.

=> Overloading Same method name with different signature, since PHP doesn’t support method overloading concept

=> Overriding When same methods defined in parents and child class with same signature i.e know as method overriding.

Example:

polymorphism Example
polymorphism Example

Output:

polymorphism Example output
polymorphism Example output

 

Leave a Reply

Your email address will not be published. Required fields are marked *