+1 vote
in Class 12 by kratos

Explain Function overloading with an example.

1 Answer

+4 votes
by kratos
 
Best answer

When several function declarations are specified for a single function name in the same scope, the function is said to be overloaded. In other languages, the same function name can be used to define multiple functions with different number and type of arguments, def test():

function 1 print “hello”

def test(a, b): #function 2

return a+b

def test(a, b, c): #function 3

return a+b+c 2

...