Computer Science, asked by aizah29, 8 months ago

What is similarity and difference among overloaded functions?

Answers

Answered by CoderRishav
1

Answer:

see, the similarities is that there name will same and difference is they don't take same argument.

Explanation:

for eg -

void mult(int a, int b)

{

System.out.println(a*b);

}

void mult(int a)

{

System.out.println(a*10)

}

in above I have created 2 functions of same name but if I give two arguments like this "mult(5,5)" then output will be "25" and but if I give one argument like this "mult(5)" then the second function will works and output will be "50" but if I give "mult()" then it will Show error because no argument function we had not make it earlier .

Similar questions