What is overloading and how can this be done ?
Answer Posted / senthil kumar
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 (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 ? | 0 Yes | 4 No |
Post New Answer View All Answers
What is the correct way of declaring an xml namespace?
how to print invert pyramid in c#
What is byte c#?
Can you pass parameters to destructors?
How to get the sum of last 3 items in a list using lambda expressions?
Is static class thread safe in c#?
What is the class in c#?
what optimizations does the c# compiler perform when you use the /optimize+ compiler option?
Can constructor have return type c#?
What is namespace in oops?
What are the different approaches of passing parameters to a method?
What is the difference between a function and a method?
How do we achieve encapsulation in c#?
How to find out that the code is written as managed or un-managed code?
What is a class c#?