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

What is difference between an Structure and Class?

651


What are the types of methods in c#?

553


What is the default value of decimal in c#?

586


What is the difference between int and int in c#?

578


What is sqladapter c#?

627






What is jagged array?

625


What is dbcontext c#?

590


What is strong data type in c#?

568


How long will it take to learn c sharp?

582


Is enum a class c#?

581


What is parameter c#?

620


Show us in simple steps to create setup & deployment project for windows application?

579


In the page load event I assigned dropdownlist’s datasource property to a valid list. On the submit button click.. The same datasource property is coming as null. Why?

561


What are satellite assemblies?

629


What is concrete class in c# with example?

561