Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is disco?

983


Can we inherit abstract class in c#?

965


Why do we need to override in c#?

1013


Explain the difference between .net and c#?

984


What's the difference between the debug class and trace class? Documentation looks the same.

1171


Do vs while c#?

943


What is event and delegates in c#?

1038


What is the function of .IsDescendent()?

1064


What is collection class c#?

972


What does ienumerable mean?

974


Can arraylist store different data types in c#?

1047


Can I define a type that is an alias of another type (like typedef in c++)?

1016


What does args mean in c#?

950


Explain polymorphism in c# with a simple example?

988


What is the difference between list and arraylist c#?

1124