我的界面层次结构类似于 -
interface Type
{
Type copy();
};
interface SubType extends Type
{
};
interface SubSubType extends SubType
{
};
还有一个具体的类
public class Concrete implements SubSubType
{
@Override public Concrete copy() { return new Concrete(); }
}
我希望能够在 Type 上调用 copy() 并取回 Type,在 SubType 上调用 copy() 并取回 SubType 等等。这可以实现吗?可能与泛型?
提前致谢。