0

Polymorphism and overriding

Help, I cannot recognize difference between Polymorphism and Overriding. Examples in java tutorial look just like same. What is the differrence between them?

21st Mar 2019, 2:21 PM
NOZ
NOZ - avatar
1 Answer
+ 1
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:08 PM
Rajan Singla
Rajan Singla - avatar