Thursday, 4 September 2014

Method Overloading

C sharp , Programing


1. what is Method Overloading with Example .





Ans:overloading is what happens when you have two methods with the same name but different signatures
The process of creating more than one method in a class with same name or creating a method in derived class with same name as a method in base class is called as method overloading.
 overloading is what happens when you have two methods with the same name but different signatures.

Example:

using System;
namespace  programCall
{

 Class MyClass
{
Public void  MyClass() //No Parameterized
{
}
Public void  MyClass(int Age) //One Parameterized
{
}
Public void  MyClass(int Age, String Name) // Two Parameterized
{
}
 Static void main()
{
Myclass c1=new Myclass();
c1.MyClass();
}
}

No comments:

Post a Comment