answersLogoWhite

0

The need for function overloading is to allow the same function call to accept different parameter types and/or a different number of parameters. The function signature differentiates the functions. The return type is also part of the signature, and needn't be the same for every overload.

Where the function signature is largely the same, with the same count of parameters but a different parameter type and return type, template functions can provide an alternative method of creating the function overloads. The compiler generates the necessary code for you, on an as-required basis, so you only need to write the function once, rather than once for each type.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Is it possible to do operator overloading in c?

No. Operator and/or function overloading is only a C++ thing.


What is the c plus plus program to calculate the area of a circle using function overloading?

Function overloading is used when you want to re-use the same function name with different argument types or a different number of arguments. Calculating the area of a circle isn't the sort of function that requires overloading since the only argument you need is the radius. double area_of_circle (const double radius) { const double pi=4*atan(1); return pi*radius*radius; }


What is function overloading in c language of computer?

There is no such thing as function overloading in C; that is a feature of C++. Function overloading allows us to provide two or more implementations of the same function. Typically, we use function overloading so that the same function can cater for different types. For instance, we might provide one implementation that is optimised to handle an integer argument while another is optimised to handle a real argument. We can also use function overloading to provide a common implementation of a function which can then be invoked by overloads that handle the low-level type conversions.


What is an operator overloading in C?

one function but multiple behaviours depending on the parameters


What is the operator of power in c plus plus?

There is no "power" operator in C or C++. You need to the use the math library function pow().


Why do you use of operator overloading in c?

Overloading, Overriding, Polymorphism, Information Hiding, Inheritance all these are CONCEPTS of C++ and Java. An Object Oriented Language and not of C language. Thats why Bjarne Stroustrup came up with C++ ...


What are the building function in c plus plus?

There is no such term as "building function" in C++.


How do you correct the C plus plus programming error missing function header?

You need to #include the header file that contains the missing function's declaration.


Why use new and delete operator overloading in c plus plus?

one reason to use new and delete operator overloading in c++ is when you are using your own memory manager code. when the user of your code calls the new keywork, your memory manager code can allocate memory.


A c plus plus statement that invokes a function is known as?

...a function call.


When will you make a function inline in c plus plus?

yes,we can make function inline


What is the only function all C plus plus programs must contain?

Every C plus plus program that is a main program must have the function 'main'.