The perfect real-world example of polymorphism will be human behaviour, sometimes we act differently according to the place. A person can be called a student, a son, or an employee based on the location in spite of being the same person.
In Python programming, polymorphism is one of the concepts of object-oriented programming which defines the characteristics of classes if the child class and parent class have methods with the same name.
Pros
- Polymorphism helps programmers to reuse the code,
- Polymorphism helps testers to easily debug the code,
- Polymorphism reduces coupling between different functionality.
Cons
- It is difficult to implement polymorphism in code,
- Polymorphism creates performance issues in runtime,
- Polymorphism implemented code becomes difficult to read.
To learn more about Polymorphism, please use the resources.
Approved by experts