0

If in a program their are two function which share same number of arguments ,then function overloading work ?

1st Feb 2020, 2:09 PM
Vipin Singh Negi
Vipin Singh Negi - avatar
2 Antworten
+ 3
At least in java you overload methods with different parameters It shares same number of arguments however they differ in data type. void myFun(int x) {} void myFun(double x){} void myFun(double x, int y) {}
1st Feb 2020, 2:25 PM
HNNX 🐿
HNNX 🐿 - avatar
+ 3
Overloading works when there are two functions with same name but- 1) differ in argument types 2) differ in number of arguments You cannot overload a function just by changing the return type.
1st Feb 2020, 2:35 PM
Avinesh
Avinesh - avatar