雖然我通過派生數據類型,但在執行的最後一行中確實存在問題。無法弄清楚。謝謝。通用類和傳遞派生數據類型
public class ExtendedDHvalue extends DHvalue {}
public class DerivedHolderUnique<T> {
private Class<? extends T> a;
public DerivedHolderUnique(Class<? extends T> a){
this.a = a;
}
public Class<? extends T> getA() {
return a;
}
public void setA(Class<? extends T> a) {
this.a = a;
}
public static void main(String[] args){
ExtendedDHvalue eDV = new ExtendedDHvalue();
DerivedHolderUnique<DHvalue> dhu = new DerivedHolderUnique<DHvalue>(eDV);
}
}