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 are implementation inheritance and interface inheritance?
What is mvc pattern in c#?
How can I get the ascii code for a character in c#?
What are the steps to create a webservice and consume it?
What is keywords in c#?
What are delegates and why are they required?
How a two-dimensional array declared in C#?
Can I define a type that is an alias of another type (like typedef in c++)?
What is lock statement in C#?
Why are dynamic link library used over static one?
What is difference between static and constant variable?
What does int32 mean?
Which are the loop types available in c#?
Is c# a keyword?
What is a streamwriter in c#?