I am trying to do something like this in C#
public class ParentClass {
public static ParentClass GetSomething()
{
var thing = new // ?????
return thing;
}
}
public class ChildClass : ParentClass {
}
And then I want to be able to call the static method on the child class like so:
ChildClass blah = ChildClass.GetSomething();
e.g. When calling the static method on the child class I want to instantiate an instance of the child class. But I just want the static method defined on the parent. Is this at all possible? I'd be happy even with:
ChildClass blah = (ChildClass) ChildClass.GetSomething();
Thanks!