Function Overloading in C#

Posted on Updated on

Untitled53434Function Overloading

This tutorial will helps you to know about Method or Function or Procedure overloading in C#. First Question arises is that what is Method Overloading or Function Overloading.

Very simple answer to this question is that have you ever heard about some words that have different meaning in different contexts?

For example there is a word “who”. If we use who in the beginning of a Sentence it appears like a Question or Interrogative Question. But same word can be used to re-call somebody in a context.


1. Who are you? (Interrogatives sentence)

2. And the person who stolen things from the market is my relative. (Referencing someone)

Likely, if there are two methods or functions with the same name exist in a program but having different parameters and performing different work at different instances then this condition is known as Function Overloading.


void calc (int, int) //can be used to sum two numbers

Void calc (int, int, int) //can be used to multiply three numbers

Now, in the above example, function calc is used to perform different operation with different parameters. This is what we called Function Overloading.

In C#, it is done in the same way as done in prior oops based languages like C++, Java.

using namespace <program-name>

//Firstly create two public functions with same name in a class.

class moverload


public void area(int a, int b)


Console.WriteLine(“Area of rectangle={0}”, a * b);



public void area(double a)


Console.WriteLine(“Area of Circle={0}”, 3.14 * Math.Pow(a, 2));




namespace moverloading


class Program


static void Main(string[] args)


moverload obj = new moverload();

Console.WriteLine(“Enter length and breadth=”);

int len = int.Parse(Console.ReadLine());

int breadth = int.Parse(Console.ReadLine());

obj.area(len, breadth );






Enter length and breadth= 20,30

Area of rectangle=600


For more details and queries please feel free to email, visit or call us. Wishing you the very best for all your future endeavors.
Helpline: 9814666333, 8699444666

Please fill the form and we shall contact you soon.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s