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 do I automate my desktop application?

709


Is 0 an unsigned integer?

675


What is a trace and asset? Explain some differences?

957


What is xml serialization and deserialization in c#?

697


What is the difference between proc. Sent by val and by sub?

681


Why are strings immutable c#?

657


Does c# support const methods, properties, or events?

744


What are the boolean data types in c#?

701


what is partial assembly reference

737


What is private class in c#?

674


What is method in c#?

655


What are the 4 pillars of any object oriented programming language?

660


Define assert() method? How does it work?

843


What to implement on my class Finalize or IDisposable

747


What is session state in asp net c# with example?

666