0

Is polymorphism and overridden both and same?

2nd Mar 2017, 4:24 AM
saif ali
saif ali - avatar
2 Respuestas
0
Polymorphism means that an object can take many forms. Simply said you can assign its value to instance of any class upper in hierarchy and any interface it implements. For example, if class B extends class A and class C extends class B and also C implements I and J then you can assign instance of C to variables of any of A, B, I and J. So C can take 5 forms and that is polymorphism
2nd Mar 2017, 5:06 AM
Konstantin Eremin
Konstantin  Eremin - avatar
0
They are not the same, because when you use overloading you have methods with different parameters, and this work for instances of the same class, but in polymorphism you have instances of different classes (all of them subclasses of the same superclass) with different implementations of the exactly the same method (or methods if you have more than one method).
12th Mar 2017, 4:10 PM
José Reynaldo Bautista Palomino
José Reynaldo Bautista Palomino - avatar