+ 9

Brifly and simply explan what is Polymorphism 😧😧 ?

11th Apr 2019, 7:05 AM
Kalhara indrachapa
Kalhara indrachapa - avatar
6 Respuestas
+ 4
Poly=many Morph=forms Polymorphism is nothing but " one method can we use many ways" We will take one method that method have method name and parameters 1) reuse()//method without- parameters Now, we are taking same method 2) reuse(int a)//with single parameter 3) reuse(int a, int b)//with double parameters Above we used one method name "reuse" with created 3(many) different "reuse" methods is nothing but polymorphism
16th Apr 2019, 7:34 PM
ram
ram - avatar
+ 6
There are two forms of Polymorphism, static and dynamic. Static polymorphism can be achieved making use of method overloading, meaning several methods with the same name but different parameters. (Check my profile) https://code.sololearn.com/cIxdYqfW30FL/#java Dynamic polymorphism can be achieved by method overriding, so lets take example (In my profile), I have a rectangle[ShapeRectangle] which is a subclass and is assigned to the superclass called Shape [which in this case is a square]. So now if we call the overriden method[ShapeRectangle] on the super class reference [Shape], then it will return the value of the [ShapeRectangle] https://code.sololearn.com/c5o66C8ilpah/#java
11th Apr 2019, 7:50 AM
Nico Engelbrecht
Nico Engelbrecht - avatar
+ 3
Means everyone can dance: someone.dance(); But depend on their countries, cultures, they would dance differently. Mexican mexBoy = new Mexican(); mexBoy.dance(); //Mexican style Indian indiGirl = new Indian(); indiGirl.dance(); //Indian style
14th Apr 2019, 10:05 AM
Hoàng Đặng
Hoàng Đặng - avatar
+ 1
1 function have many forms example: mobile phone
14th Apr 2019, 4:51 AM
Vinay Gupta
Vinay Gupta - avatar
+ 1
Same function/method names but with different parameters.
16th Apr 2019, 2:14 PM
Pat Pat
Pat Pat - avatar