斑竹新上任,请教一个程序结构问题,捧场......
斑竹新上任,请教一个程序结构问题,捧场......
其实是关于多重继承的,对接口理解不深,实施总有点别扭:
class A {
JTextField aText;
int aInt;
public void setText(JTextField newText) {
aText=newText;
}
public void setData(int newInt) {
aInt=newInt;
}
}
class A_son_1 extends A {
...
}
class A_son_2 extends B {
...
}
class B extends Frame {
JTextFiels aText;
int aInt;
A_son_1 aSon1=new A_son_1;
A_son_2 aSon2=new A_son_2;
C c=new C;
aText=c.initText(); //...
aInt=c.initInt(); //...
aSon1.setText(aText);
aSon2.setText(aText);
aSon1.setData(aInt);
aSon2.setData(aInt);
}
class C {
public JTextField initText() {
...
}
public int initInt() {
...
}
}
想让 class B 也同时 继承 class A.How to ?
怎样做更规范????