Content deleted Content added
short description, formatting, links Tags: Mobile edit Mobile app edit iOS app edit |
No edit summary Tag: Reverted |
||
Line 7:
{{Polymorphism}}
In programming language 'Method overloading' or you can say 'Function overloading' is very important concept to apply in real life entities. First of all Method Overloading or Function Overloading is a very important concept part of OOPs(Object Oriented Programming). It is based on polymorphism. The word 'Polymorphism' means a same person or an same object is represented like various kinds of things as per situation, like a person is called as an Employee, as a son, as a bhaiya, as a bhai is called in different situation. So how we determine what is the method or function 'overloading'?
Ans: The function or method overloading is a concept that allows different methods having different type of parameters having the same name of more than one method and also having the different signatures.(Signatures represent the difference is represented by the number of input parameters and type of parameters).
__Let's take an example__
class example {
public int multiplication(int x, int y) {
return x*y;
}
public int multiplication(int x, int y, int z) {
return x*y*z;
}
public double multiplication(double x, double y) {
return x*y;
}
}
→ NOTE: Here, the name of the method or function is 'multiplication'. But this method has different no. of parameters and different datatype of parameters. So, as per user input the all method works properly. Method overloading can be achieved by changing the number of parameters while passing to different methods.
==Languages supporting overloading==
|