The word polymorphism comes from two Greek words i.e., poly & morphism which means that same name but multiple form.
In programming language, Polymorphism means the name of elements to be same but having different properties. In simple words, suppose two functions have the same name but the definition of both the function are different. This concept is very useful in programming world.
Concept of Polymorphism in programming,
- Function Overloading
- Operator Overloading
Function Overloading
Function overloading is a feature of object oriented programming which allows us to create two or more than two function with same name but the condition is that there behavior and there parameters have to be different.
For example,
Suppose two function are there with the same name area() but one area() is for finding the area of circle and one are is for finding the area of the perimeter.
Operator Overloading
Operator Overloading is a feature of object oriented programming which allows to give different definition to the same operator.
For Example,
Suppose the same operator + may used for addition of two number and also used for concatenation of two strings.
ALSO READ,
- Difference between C and Java
- Difference between C++ and Java
- Structure of Java program
- Data types in java
Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!
Reply !stop to disable the comment. Thanks!
Congratulations @shivangi! You have received a personal award!
1 Year on Steemit
Click on the badge to view your Board of Honor.
Do not miss the last post from @steemitboard:
Congratulations @shivangi! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!