What is the use/advantage of function overloading

Please suggest use of FO

Showing Answers 1 - 17 of 17 Answers

jyothi

  • Oct 7th, 2005
 

the use of function overloading is to save the memory space.

  Was this answer useful?  Yes

EswaraPrasad

  • Oct 20th, 2005
 

the use of function overloading is to save the memory space,consistency and readabiliy.

venkatesh

  • Nov 17th, 2005
 

we can develop more than one function with the same name

  Was this answer useful?  Yes

Malathi

  • Mar 28th, 2006
 

function overloading is essential to allow the function name (for example the constructor) to be used with different argument types.

  Was this answer useful?  Yes

navneet sahota

  • Mar 28th, 2006
 

how memory space is saved?

  Was this answer useful?  Yes

ABHAY

  • Oct 12th, 2006
 

Overloading: providing multiple behaviour to same object with respect to attributes of object.

see in programming, every thing is object. u r program also an object, function is also an object.

by using function overloading, we can  call specific behaviour of that according to what attributes we set at  compiled time.

mean we don't need to write different function name for different action.

  Was this answer useful?  Yes

Dhananjoy Chakraborty

  • May 5th, 2007
 

Function overloading exhibits the behavior of polymorphism which helps to get different behaviour, although there will be some link using same name of function. Another powerful use is constructor overloading , which helps to create objects differently and it also helps a lot in inheritance.

  Was this answer useful?  Yes

Sunny

  • May 7th, 2007
 

For eg: Say a method called addUs(a,b) adds a and b.
So the definition will be

int addUs(int a, int b){

 return a+b;

}

But now if you want your arguments to be Objects of a class say
class Demo{
int height;
int width;
}
You want the same function addUs() to return a new object which would have attributes height and width having values as sum of the height & width of the 2 arguments passed.

So now the definition would be:

Demo addUs(Demo a, Demo b){
 this.height = a.height + b.height;
 this.widht = a.widht + b.width;
 return this;
}

  Was this answer useful?  Yes

sharda prasad singh

  • Jul 28th, 2007
 

Function overloading is one or more funcation has different number of argument or diffrent type of argument but all have same return type otherwise it create ambitious to knowing which function u may want to call. It is also save the memory space and provide compile time polymorphysm.

  Was this answer useful?  Yes

NEHA SINGHAL

  • Aug 5th, 2007
 

In function overloading memory is saved, but its time consuming & then we use inline function

  Was this answer useful?  Yes

lalit

  • Oct 10th, 2007
 

It speeds up the execution of programme.

  Was this answer useful?  Yes

dharme kalita

  • Sep 22nd, 2011
 

using the concept of function overloading; we can design a family of functions with one function name but with different argument lists. the function would perform different operations depending on the argument list in the function call.

  Was this answer useful?  Yes

sachin

  • Aug 13th, 2014
 

We can Define Multiple Function with same name to perform same task. Compiler can not compile a function separately

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions