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 get set in c#?
What is file extension of webservices?
What is alias in c#?
What is the meaning of extention?
How can encapsulation be achieved?
What is readline library?
What is the use of dll file in c#?
What is jit? What are the different types of jit?
Is it possible to have different access modifiers on the get/set methods of a property?
How do you declare a method in c#?
Why do we use 0?
What is the data encapsulation?
What is the difference between delegates and superdelegates?
What is the benefit of interface in c#?
Which controls do not have events?