+1 Rehman . · April 1, 2015
Guys i'm having difficulty in understanding polymorphism, what oracle.doc says is "when your class is able to extend the functionality of previous method it is polymorphism" right ?
I read on the site " http://www.javatpoint.com/java-oops-concepts"  that polymorphism has two ways 

  1. overriding (virtual function (dynamic binding))

  2. overloading (static binding)

however orcale.doc also give the reference of virtual functions which means overriding a method is called polymorphism my question here is that:

  • What if we are overrirding a method but not using the existing functionality of method ? will it still be called polymorphism?

  • Secondly when we are simply implementing the interface and extending the functionality of base class, what do we call it ?

  • Where do Overloading stands ? is it in polymorphism or not ?

Post a Reply


Oldest  Newest  Rating
+1 Dol Lod · April 1, 2015
Polymorphism is using subclasses as members of a superclasses to become comparable to each other even though they actually are different classes or to use a subclass as a member of a superclass.

Ex. Suppose you want to compare the area of two different objects like a square and circle. Both are descended from the shape class except they are initialized as members of their respective subclasses meaning that they have the specific implementation of certain methods for their specfic subclass. 

If you implement the interface, you are essentially using polymorphism b/c you are providing a specific implementation of an interface and possible treating it as a member of that interface. That is what polymorphism is.

Overloading is not polymorphism because it simply means that you are changing the possible input arguments to a function and they could be doing completely different things. 

When you initialize a member of a super class as a member of its subclass, that is polymorphism if you continue to treat it as a member of that super class and it will use the subclass's specific methods for the functions of the super class. 
0 Rehman . · April 1, 2015
Sorry i still didn't get it, i'm thinking like take any class who's functionality can be extended with more than 2 "is-a" relationship will be called polymorphic!
These site are taking overloading into polymorphism too, therefore now its starting mess in my mind 

  1. http://beginnersbook.com/2013/03/polymorphism-in-java/

  2. http://howtodoinjava.com/2013/07/15/what-is-polymorphism-in-java/

  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator