Sage Software Interview Question
InternsCountry: UK
Interview Type: In-Person
polymorphism is a concept in programming which describe how to make many different forms. Of the code.
We can describe it like:
1. If I make a code generic to many types
2. Method overloading
3. In inheritance, we can find method overriding, and casting the parent class to one of its child classes (i.e. a good example of that the paint program, making array of shapes to hold the shapes, and shapes is a parent class that has a lot of children like rectangle, square, circle,...etc)
polymorphism is oops concept which means ability to take more then one form or we can say one name many forms. e.g. in a company there is PE for java, PE for .Net, PE for php and many other PE for different -2 languages but in all there is one thing is common which is PE. which PE(project Eng.) is one name having different forms like java,.net,php and so on.
other real life examples: captain(hockey,cric,football...),HOD(A,B,C)
Polymorphism increases the readability of code for example you want to make a function to sum 2 no. , sum 3 no... so your code is..
sum2(int,int)
sum3(int,int,int)
but if u use polymorphism then ur code become
sum(int,int)
sum(int,int,int)
which increases the readability of code u dont have to remember the name for all function u have to remember only one name... that is polymorphism
The ability to take more that one form, it supports Method Overloading & Method Overriding.
- Anonymous February 02, 2014