2
Reply

What do u mean by Function Overloading ?

Raj Kumar M

Raj Kumar M

16y
7.5k
0
Reply

    Function overloading means put parameters in the head of the function example: int function() { int a = 3; int b = 2; return a+b; } when I invoke this function in Main method it returns 5 Main() { int x = function(); Write(x); } but if I want that user gives a and b parameters I overload the function I put a and b in the head of the function between the parentheses int function(int a, int b) { retrun a+b; } Main() { int x = function(2,5); write(x); }

    When more than one function is created with the same name, but different is of there arguments . In other words, function names can be overloaded. A function may also have the same name as an attribute. In the casethat there is an ambiguity between a function on a complex type and an attribute of the complex type, the attribute will always be used.