What is function overloading and operator overloading?
Answers
using the same function for different purposes depending on different parametersis called function overloading
eg: public static int sum(int a,int b){
print(a+b);
}
and
public static int sum(int a,int b,int c){
print(a+b+c);
}
here same named method sum is used in two ways...
using the same operator for different purposes is called operator overloading.
eg : + operator is used for addition if numbers and for concatenation if strings.(in java not sure abt other languages)
Answer:
Function overloading : ... Function overloading reduces the investment of different function names and used to perform similar functionality by more than one function. Operator overloading : A feature in C++ that enables the redefinition of operators. This feature operates on user defined objects.