What is overloading and how can this be done ?
Answer Posted / rashid
Overloading is the process of call the same method with
different parameter types,diferent order of parameters with
in the class.Its also applicable for the constructor.
here i give some example
class sample
{
public void display()
{
Console.WriteLine("display :1");
}
public void display(int i,int j)
{
int s=0;
s = i+j;
Console.WriteLine("Result :"+s);
}
}
class Overload
{
public static void Main(string []args)
{
sample s = new sample();
s.display();
s.display(5,5);
}
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
Can we have two main methods in c#?
What is c# and why it is used for?
What method is used to sort the elements of the array in descending order?
Is c# easier than c++?
Why to use “using” in c#?
Is boxing an implicit conversion?
How the versioning applies to Assemblies or can you explain version numbers?
What is the base class in .net from which all the classes are derived from?
Can constructor be private c#?
What is regex replace in c#?
What is the usage of OLE?
what is a static constructor?
If a class derives from another class, will the derived class automatically contain all the public, protected, and internal members of the base class?
How to use the sreamReader class to read form a text file?
What are events in C#?