STATIC METHOD CAN BE OVERLOADING AND OVERIDNG? IS POSSIBLE IN
iN c# .NET AND WHAT IS THE REASON??
Answers were Sorted based on User's Feedback
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 |
Answer / dinesh sharma
In C# Static Method is Overloaded but not override because override always used in drive class.but in case of static can not provide inheritance.
Is This Answer Correct ? | 9 Yes | 0 No |
STATIC METHOD CANT BE OVERLOAD AND OVERIDE.I DONT NO EXACT REASON.................
Is This Answer Correct ? | 4 Yes | 12 No |
i have a question which is quite simple but yet complicated for me my question is why do we use void, if it does not return anything to the compiler? if it is used for normal display it can also be done by what is called Console.Write() or Consol.WriteLine() and if i do not use void with my method then my compiler throws me an error. if i return a value say integer then i write public int fun() display of the result can also be done here then why is it so necessary to use void with a function and why so compiler throw us an error if v don't use void return type?
How can i load the text box and label at the runtime based on the existing text box and tabel
2 Answers Merrill Lynch, Patni,
What is out in c#?
What is dataset and dataadapter in c#?
What is difference between comparable and comparator?
How do I run managed code in a process?
What is difference between encapsulation and abstraction in c#?
Can we make a class private in c#?
How many bytes is an int c#?
What are the benefits of using generics in c#?
What is the difference between continue and break statement?
What is the difference between a function and a method?