This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / Java question: it that possible to refer to the method of super super class?
-fatbean(青年发明家:零零发);
2004-10-20
{1617}
(#1938826@0)
-
try thisYou can try. I can't guarantee it works.
public class Son extends Father {
public add(Object a) {
((GrandFather)this).add(a);
......
}
}
-smallwhale(喝不了咖啡);
2004-10-20
{158}
(#1939740@0)
-
This way should work.
-fall_leaf(一叶知秋);
2004-10-20
(#1939986@0)
-
可能吧
-gone123(gone123);
2004-10-20
(#1939998@0)
-
都是你,害得我连偷偷改回来的机会都没有了。呵呵!
-fall_leaf(一叶知秋);
2004-10-21
(#1940251@0)
-
哎,我想写的是This way should not work. 可真是的。
-fall_leaf(一叶知秋);
2004-10-21
(#1940249@0)
-
how about create a special method, say superAdd() in Father to call GrandFather's add(), then in your grandson object, use super.superAdd()?
-tongcd(Rock Your Body);
2004-10-20
(#1939924@0)
-
1. I don't think smallwhale's would work. 2. tongcd's no good either :) remember, father is not your code, next time the api get upgrade, you have to modify father again. 3. imho, getting your uncle is the best way.
-xanada(㊣流水);
2004-10-20
(#1940090@0)