Overloading:
1.When we create same name method within a class with different arguments is
called overloading.
2.In Overloading, Compiler decide at the compile time that which method has
to be called.
3.The number of arguments or order of arguments must be different.
4.The return type may be different of overloaded method.
5.The access modifier may be different of overloaded method.
6.Exception can be change.
Overriding:
1.If we creates same name method in child class than it is called overriding.
2.Code associated with a given method call is not known until the time of call at
run time that also called dynamic binding.
3.The argument list must be same.
4. The return type must be same.
5.The access modifier must not be more restrictive then the parent class method.
6.Exception must not throw a new or broader exception.
1.When we create same name method within a class with different arguments is
called overloading.
2.In Overloading, Compiler decide at the compile time that which method has
to be called.
3.The number of arguments or order of arguments must be different.
4.The return type may be different of overloaded method.
5.The access modifier may be different of overloaded method.
6.Exception can be change.
Overriding:
1.If we creates same name method in child class than it is called overriding.
2.Code associated with a given method call is not known until the time of call at
run time that also called dynamic binding.
3.The argument list must be same.
4. The return type must be same.
5.The access modifier must not be more restrictive then the parent class method.
6.Exception must not throw a new or broader exception.
No comments:
Post a Comment