In short polymorphism is the condition of occurence in difference forms. Confused ?
Lets look a example.
Polymorphism in addition operator: main.py
x = 10
y = 20
print(x+y)
a = "Arif "
b = "Shahriar"
print(a+b)
output:
30
Arif Shahriar
Here +
operator performs mathematical addition for integers and concatination for strings. Same operator does different operation for different data types. This is the Polymorphism of addition operator.
For more example checkout this link.
In the next some tutorial we will discuss about :
-
Duck Typing
-
Operator Overloading
-
Method Overloading
-
Method Overriding