STATIC METHOD CAN BE OVERLOADING AND OVERIDNG? IS POSSIBLE IN
iN c# .NET AND WHAT IS THE REASON??
Answer Posted / sudhir sheoran
Static Methods can't be override because static methods can only be accessed using class name and are inaccessible to the objects of the class. So no question of overriding.
But canbe overloaded. See the below example:
class Program
{
static void Main(string[] args)
{
abc.calculate(2, 3);
abc.calculate(2.0, 3.9);
Console.ReadLine();
}
}
public static class abc
{
public static void calculate(int a,int b)
{
Console.WriteLine("Int");
}
public static void calculate(double c,double d)
{
Console.WriteLine("Double");
}
}
| Is This Answer Correct ? | 25 Yes | 1 No |
Post New Answer View All Answers
What is xor operation?
Is hashset serializable c#?
What is the difference between int16 and int32 in c#?
How many bytes is an int c#?
Can I call a virtual method from a constructor/destructor?
Explain the three services model (three-tier application). Presentation (ui), business (logic and underlying code) and data (from storage or other sources).
How to create multi-dimensional array?
Can we inherit private class in c#?
Is c# pass by value?
Does c# provide copy constructor?
What is difference between web and window application?
What is uint64?
What is a collection in c#?
What is dependency in software?
What are c# collections?