What is overloading and how can this be done ?
Answers were Sorted based on User's Feedback
Answer / 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 |
overloading is nothing but method name is same but perameters is different.
for example
class overloading
{
public void add(int x)
{
console.writeline("sum");
}
public void add(int x,int y)
{
console.writeline("THE SUM IS:"+(x+y));
}
}
Is This Answer Correct ? | 1 Yes | 0 No |
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 |
What is jagged array in c#?
What is garbage collector and where should you use in .NET?
what is application domain?
What is array collection?
Is c# and c sharp same?
What is thread and explain states of a thread in c#?
Why array is faster than arraylist in c#?
How Is The Dll Hell Problem Solved In .net?
What is an array of arrays called?
How does insertion sort work?
What is difference between static and readonly in c#?
Which language is used for desktop application?