Polymorphism & its types

in #programming6 years ago

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,


Sort:  

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:

SteemitBoard Ranking update - Steem Power, Followers and Following added

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @shivangi! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

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!

Coin Marketplace

STEEM 0.26
TRX 0.20
JST 0.038
BTC 97158.43
ETH 3589.50
USDT 1.00
SBD 3.86