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


Please Help Members By Posting Answers For Below Questions

Why do we use threads in c#?

508


What is string literal in c#?

521


Can private virtual methods be overridden in c#.net?

520


Major difference between Basic httpbinding and WShttpbinding?

577


What is view state c#?

513






How long does it take to learn c# for unity?

480


What is a statement c#?

498


What is a class in unity?

480


Is stringbuilder thread safe c#?

473


What is the advantage of constructor in c#?

491


Explain hash table in c# ?

652


explain the features of static/shared classes.

495


Explain the term inheritance in C#.

532


Which of these statements correctly declares a two-dimensional array in c#?

648


What is object array in c#?

505