Friday, 29 July 2016

Real life example of Polymorphism

Real life example of Polymorphism


An Object is in different forms and in each form its exhibit the same functionality but the implementation is different.

Another definition of polymorphism;

Polymorphisms is nothing but ability to take more than one forms(One Interface,Multiple Methods or One Name,Many Forms).

Example 1: 

A Person who knows more than two languages he can speak in a language which he knows. Here person is Object and speak is polymorphisam.

Example 2: 

Another Common Example: you don't "need to know the internal working of the mobile phone to operate" with it. You have an interface to use the device behaviour without knowing implementation details.

Example-3: 

A Teacher behaves to student.
A Teacher behaves to his/her seniors.
Here teacher is an object but attitude is different in different situation.

Example-4: 

Person behaves SON in house at the same time that person behaves EMPLOYEE in office.

Reference: Real Life Example of Polymorphism

No comments:

Post a Comment