Difference between overloading and overriding.


=> Overriding :-
             Same method name with same arguments and same return types  associated in a class and sub class.

Class


=> Overloading :-
             Same method name with different arguments may or may not be in the same class itself.

a) diff no of parameters :-
              public void method(int a)
              public void method(int a, int b)

b) diff type of parameters :-
               public void method(int a)
               public void method(float a)

c) diff order of parameters :-
                public void method(int a,float b)
                public void method(float b,int a)

Share

& Comment

0 comments:

Post a Comment

 

Copyright © 2019 HART™ is a registered trademark.