GeekInterview.com
Series: Subject: Topic:
Question: 79 of 85

What is the use/advantage of function overloading

Please suggest use of FO
Asked by: Interview Candidate | Asked on: Oct 5th, 2005
Showing Answers 1 - 16 of 16 Answers
jyothi

Answered On : Oct 7th, 2005

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

  
Login to rate this answer.
EswaraPrasad

Answered On : Oct 20th, 2005

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

  
Login to rate this answer.
venkatesh

Answered On : Nov 17th, 2005

we can develop more than one function with the same name

  
Login to rate this answer.
Malathi

Answered On : Mar 28th, 2006

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

  
Login to rate this answer.
navneet sahota

Answered On : Mar 28th, 2006

how memory space is saved?

  
Login to rate this answer.
asp_sridhar

Answered On : Apr 25th, 2006

View all answers by asp_sridhar

how the memorey space is saved???

  
Login to rate this answer.
ABHAY

Answered On : 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.

  
Login to rate this answer.
Dhananjoy Chakraborty

Answered On : 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.

  
Login to rate this answer.
Sunny

Answered On : 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 newobject 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;
}

  
Login to rate this answer.
sharda prasad singh

Answered On : 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.

  
Login to rate this answer.
NEHA SINGHAL

Answered On : Aug 5th, 2007

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

  
Login to rate this answer.
lalit

Answered On : Oct 10th, 2007

It speeds up the execution of programme.

  
Login to rate this answer.
vikas_3000

Answered On : Aug 13th, 2008

View all answers by vikas_3000

Function overloading is done for code reuseability, to save efforts, and also to save memory.

  
Login to rate this answer.
msuresh70

Answered On : May 25th, 2009

View all answers by msuresh70

It helps app to load the class method based on the type of parameter

  
Login to rate this answer.
mahek.j.mehta

Answered On : Mar 1st, 2010

View all answers by mahek.j.mehta

It is useful for Saving the Memory.

  
Login to rate this answer.
dharme kalita

Answered On : 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.

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.