我正在编写如下代码,我需要从父类的静态方法中获取子类的值。
有人可以帮我解决吗?先谢谢了。
public abstract class DataObject<T>{
public static int GetAllTotal(){
// How can I obtain a T propery called "code" = "001".
int cont = SQL.getTotalFromQuery(
"SELECT * from tblProducts where code = '001'"
);
return ffff
}
...
}
public class Product extends DataObject<Product>{
private String code = "001";
public Product(){
}
}
...
Product.GetAllTotal();