User Id :    Password :      New Member   Forgot Password  
Topic: What is function overloading
Anamika singh
22 Jan 2012 at 07:18 AM

What is function overloading?If we have two function like Public class abc(a,b) return type int. and Public class abc(a,b,c) return type string ? What will happen?
 

Re: What is function overloading
PJain
22 Mar 2013 at 04:26 AM

 Function overloading stands for the Functions that have same name but different parameters,

For example there is two function Method(int a,int b) and Method(int a, int b, int c).

Here the parameter are differ in terms of 'number of arguments'.

Argument can be differ in terms of data types of argument and no of arguments. like Method(int a,string b) is also a overloaded function because the type of argument is differ.

Function overloading depends on the Argument not on the return type.

So int Method(int a,int b) and void Method(int a,int b)  is not overloaded because type of argumentand no of argument is same in both functions.

if we have same return type and difference in parameter then it is also overloaded.

 

 

Re: What is function overloading
PJain
22 Mar 2013 at 04:27 AM

 In your case function is overloaded due to difference in parameter

Total Replies: 2
 
Featured Text Ad

Featured Ad