Topic: 请教大家一个继承的问题! |
Print this page |
1.请教大家一个继承的问题! | Copy to clipboard |
Posted by: chzh112 Posted on: 2004-09-10 09:12 我想写个界面的基类,然后子类继承它,在它的基础上再加些控件,有以下2种方法实现,大家帮我看看是否正确,或者还有其他的正确方法,,, method 1: 父类: pulibc class A{ public A(){ super(); } public void initFrame(){ ***component code*** } } 子类: public class B extends A{ public B(){ super(); initFrame(); } public void initFrame(){ ***my tableVector code*** super.initFrame(); ***other component code*** } } method 2: 父类: public class A{ public A(){ } public void initFrame(){ ***component code*** } } 子类: public class B extends A{ public void subInitFrame(){ ***my tableVector code*** ***other component code*** } public B(){ subInitFrame(); super().initFrame(); } } |
2.Re:请教大家一个继承的问题! [Re: chzh112] | Copy to clipboard |
Posted by: littledeer1974 Posted on: 2004-09-19 10:01 子类的InitFrame() 会不会override 父类的InitFrame() (仅是我个人的疑问) |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |