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 a constructor? What is a destructor?
What is satellite assembly? And steps to create satellite assembly?
What is #region in c#?
What is the difference between list and arraylist in c#?
Can we have two main methods in c#?
How many types of interface are there in c#?
What is a statement c#?
Can we declare private class in c#?
Where are value types stored in c#?
Does unity use c++ or c#?
What does ienumerable mean?
What is c sharp language?
What is exe file in c#?
Is array ienumerable c#?
What is dependency injection?