What is Function Overloading

What is Function Overloading

Tags..  object oriented programming
Posted by: Rajesh kumar | Views: 179 | Community Opinion: 1

Add Your Opinion

Bookmark this page..



Ask a New Question Go to Home


Community Opinion/Answers

Function overloading is the practice of declaring the same function with different signatures. The same function name will be used with different number of parameters and parameters of different type. But overloading of functions with different return types are not allowed. Like

void f(char c, int i);
void f(int i, char c);
void f(string & s);


For example, a print function that takes a string (or char *) argument performs very different tasks than one that takes an argument of type double. Overloading permits uniform naming and prevents programmers from having to invent names such as print_sz or print_d.


Function Declaration Element used for Overloading?

Function return type - No

Number of arguments - Yes

Type of arguments - Yes

Presence or absence of ellipsis - Yes

Use of typedef names - No

Unspecified array bounds - No

const or volatile - Yes



What do you think? Add your opinion/answer
Your Name:
*your opinion/answer: