How can you overload a method?
Answers were Sorted based on User's Feedback
Answer / rakesh
A class contains more than one function with the same name
but different method signature ie different access
type,return type,parameters.
public void int sum(int i,int j)
{
int tot=i+j;
Console.WriteLine(tot);
}
public void double sum(double p,double q)
{
double tot=p+q;
Console.WriteLine(tot);
}
if we are passing integer values means the first function
will invoke,and if we are passing double values means the
second will work.This is method overloading.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / niraj bajaj
Hi
@Rakesh
Return types doesnt include in these..
only different set of parameters and their access types..
Is This Answer Correct ? | 0 Yes | 0 No |
Using system; class main { public static void Main() { int a = 1; for (int i = 0; i < 10; i++) { int j = a * 5; Console.WriteLine(a + "*5=" + j); a++; } Console.ReadLine(); } }
What is default constructor in c#?
What is a Command Object in C#?
What is difference between destructor and finalize?
How is the syntax written to inherit from a class in C#?Give an example ?
what is IDisposal interface
What is the benefit of delegate in c#?
What is a service layer c#?
Is linkedhashset synchronized?
What is window application in c#?
Can we inherit private members of class in c#?
What is difference between array and list?