Java接口回调

public class A {
private D d;
private C c;
public A (C c) {
this.c = c;
}
public void setD (D d) {
this.d = d;
}
... public interface B {
public void aa();
public void bb();
public void cc();
}
}
public class C {
private A a = null;
... protected void init() {
a = new A(this);
a.setD(new D());
} protected class D implements A.B {
public void aa() {
...
}
public void bb() {
...
}
public void cc() {
...
}
}
}
上一篇:C++之把流对象当做函数参数传递


下一篇:Andriod 自定义控件之创建可以复用的组合控件