我需要一个对象B,但是当我执行'B.GetByID()'时我得到一个对象A.
public class A
{
public A()
{
}
public static A GetSelf()
{
return new A();
}
public static A GetByID()
{
return GetSelf();
}
}
public class B extends A
{
public B()
{
super();
}
public static B GetSelf()
{
return new B();
}
}
B.GetByID(); //returns A, i need B
Run Code Online (Sandbox Code Playgroud)