Method overloading
|
Method overriding
|
In a one method
existing in different forms is known as method overloading.
|
Redefining parent
class method and implementing in our own way is known as method overriding.
|
In method overloading
method name must be same and arguments must be different (least change the order)
|
In method overriding
method name must be same and arguments are must be same (arguments order
never change).
|
Method signature and
method name is different
|
Method name and
signature is same.
|
Private and static
and final methods can overload.
|
We can’t override
private and static and final methods.
|
We can change access
modifier in overloading.
|
We can increase scope
access modifier in overriding.
|
It is also known as
compile time polymorphism
(or) static polymorphism
and early binding.
|
It is also known as
runtime polymorphism (or) dynamic polymorphism (or) late binding.
|
Overloading is done
within the same class.
|
Overriding is done in
extended child classes only.
|
Subscribe to:
Post Comments (Atom)
EmoticonEmoticon