Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can you overload a method?

Answer Posted / rakesh

A class contains more than one function with the same name
but different method signature ie different access
type,return type,parameters.

public void int sum(int i,int j)
{
int tot=i+j;
Console.WriteLine(tot);
}

public void double sum(double p,double q)
{
double tot=p+q;
Console.WriteLine(tot);
}

if we are passing integer values means the first function
will invoke,and if we are passing double values means the
second will work.This is method overloading.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How long will it take to learn c sharp?

940


What do you mean by delegates and explain different types of delegates?

970


Why do I get an error (cs1006) when trying to declare a method without specifying a return type?

941


If c# destructors are so different to c++ destructors, why did ms use the same syntax?

924


in the nunit test framework, which attribute must adorn a test class in order for it to be picked up by the nunit gui?

1160


Can property be private in c#?

886


what is the difference between convert.tostring() and tostring() functions ?

1058


How do you sort an array in c#?

1012


Define c# and list the features.

1009


What is a console operator?

915


Difference between Value type & reference types ? and give the example in .Net?

942


what is partial assembly reference

947


Okay, so an int is a value type, and a class is a reference type. How can int be derived from object?

948


What is generic and non generic collections in c#?

833


Difference between directcast and ctype.

1024