+ 2

what is method overriding?

10th Jul 2016, 7:44 PM
Jayahar Harris
Jayahar Harris - avatar
3 Respostas
+ 2
here is an example that you may want to check to see difference or understand the meanings of overriding and overloading https://code.sololearn.com/c0awDMpDLukF/?ref=app
11th Sep 2017, 3:06 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
+ 1
overriding a method is used when a class needs to utilize a parent classes method in a different way. Example, third class has a method that prints the statement hi. The second class needs the third class for something but it needs the method to say hello instead of hi. you extend the class, add the method but in the body you put the new println. The SecondClass has now overridden the third classes print method.
11th Jul 2016, 2:08 AM
James
James - avatar
0
overriding is performed in different class whereas overloading is performed in same class in overriding rules method must have same name as in super class and parameters must be is-a relationship (inheritance)
5th Aug 2016, 6:55 AM
sachin tomar
sachin tomar - avatar