0
Is polymorphism and overridden both and same?
2 odpowiedzi
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
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).