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
Why do we use threads in c#?
What is string literal in c#?
Can private virtual methods be overridden in c#.net?
Major difference between Basic httpbinding and WShttpbinding?
What is view state c#?
How long does it take to learn c# for unity?
What is a statement c#?
What is a class in unity?
Is stringbuilder thread safe c#?
What is the advantage of constructor in c#?
Explain hash table in c# ?
explain the features of static/shared classes.
Explain the term inheritance in C#.
Which of these statements correctly declares a two-dimensional array in c#?
What is object array in c#?