【发布时间】:2009-10-30 18:07:30
【问题描述】:
是否可以覆盖下面代码 sn-p 中所示的泛型函数?
interface A {
}
interface B extends A {
}
abstract class C {
protected abstract <T extends A> void abc(T xyz);
}
class D extends C {
@Override
protected void abc(B xyz) {
// doesn't compile
// The method abc(B) of type D must override or implement a supertype method
}
}
谢谢
【问题讨论】:
-
你的意思是一个通用函数?我不喜欢这种“通用化”的时尚。
标签: java generics inheritance