How to inherit a static member in c#?

When inheriting static members there is no need to instantiate the defining class using the ‘new’ keyword.
public class MyBaseClass
{
MyBaseClass()
{
}
public static void PrintName()
{
}
}
public class MyDerivedClass : MyBaseClass
{
MyDerivedClass ()
{
}
public void DoSomething()
{
MyBaseClass.GetName();
}
}

0 comments:

Post a Comment