0

polymorphism Vs method overriding

how is polymorphism different from method overriding?

22nd Sep 2018, 9:36 AM
gayathri kumaresan
gayathri kumaresan - avatar
3 Antworten
+ 1
polymorphism is the concept of substituting different objects in code, the fact that an overarching type can have potentially multiple forms. Method overriding is one of the ways this is achieved, which gives the objects their different behavior
22nd Sep 2018, 12:33 PM
Dan Walker
Dan Walker - avatar
0
Method overriding is (or can be) part of polymorphism.
22nd Sep 2018, 9:55 AM
Matthias
Matthias - avatar
0
POLYMORPHISM is of two types , Function overloading that is also called method overloading and second is Method Overriding. In FUNCTION OVERLOADING, Methods have same name with different number of arguments or with different data types also. In METHOD OVERRIDING, Methods have same name with same number of arguments. METHOD OVERRIDING is only achieved by Inheritance and Interfaces. EXTRA CONCEPT OF METHOD OVERRIDING: ------------------------------------------------------------------------ Whenever methods parent has by default available to the child through inheritance sometimes child class may not satisfy with the parent method implementation. Then the child class is allow to redefine that method based on its own requirement. This process is called overriding. The parent class method is overridden is called overridden method. The child class method which is overriding is called overriding method.
3rd May 2019, 1:07 PM
Rajan Singla
Rajan Singla - avatar