answersLogoWhite

0


Best Answer

Functions with similar functionality can share the same name, eg.:

Without overloading:

int iabs (int x);

double dabs (double x);

double cabs (complex x);

With overloading:

int abs (int x);

double abs (double x);

double abs (complex x);

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

7y ago

Functions allow us to compartmentalise code and thus refactor complex code into a series of much simpler function calls. By choosing good names for the functions, code becomes largely self-documenting, reducing the amount of otherwise distracting user-comments and therefore making code much easier to read. Code that is easy to read is also easier to maintain. Functions also allow us to localise variables, limiting the scope (visibility) of variables to the functions that actually require them. This is vital in a multi-threaded application as local variables do not have to be synchronised. However, even in single-threaded applications, keeping track of all the places that interact with a global variable adds an unnecessary maintenance cost that is completely eliminated by the use of local variables.

This answer is:
User Avatar

User Avatar

Wiki User

6y ago

Functions are effectively built-in formulas. They allow you to do many things quickly and easily. Without functions, some calculations would be much more complicated and longer. Excel can do calculations with functions accurately without the user having to know exactly how the calculation is actually done. They can reduce the amount of errors that people make. They help you to use the right elements for the function, as they have defined arguments that need to be entered. There are many categorised and specialist functions for different types of users. Without functions, using Excel would be far more difficult.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Advantages of function overloading
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

define function overloading?

Defining several functions with the same name with unique list of parameters is called as function overloading.


Is it possible to do operator overloading in c?

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


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.


How operator overloading differ from function overloading?

Function overloading is multiple definition with different signatures(the parameters should be different) for the same function. The parameter list have to be different in each definition. The compiler will not accept if the return type alone is changed. Operator overloading is defining a function for a particular operator. The operator loading function can not be overloaded through function overloading.


How the compiler compiles overloaded method?

method overloading occurs when we use two functions or more with the same name.In function overloading compiler detect which method is call actually throw the parameters passed to the methods.In function overloading parameters of functions are different.


What is an operator overloading in C?

one function but multiple behaviours depending on the parameters


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 are the advantages of reproduction as a function of the family?

what are the advantages of reproduction as a function the family?


What are the similarities between constructor overloading and function overloading?

The only similarity is that both constructor and function overloads are distinguished by their signature -- the number and type of their arguments. Functions differ in that they also have a return type, which is also part of the signature, whereas constructors have no return type, not even void.


When to create a template function?

A template function is used when you want to write some kind of function that can be applied to different data types. It is a form of overloading, but you don't have to actually write all of the overloaded variants.


Rules for function overloading?

It's a way by which you use define the same function for different input types. For example, think about the the operator "+" which in java works for adding integers, floating point numbers and even string concatenation. The way such functionality is achieved is by overloading.


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++ ...