[img]http://tiantian911.iteye.com/upload/picture/pic/6667/b14f1c72-8870-352c-87ca-463f264be6ca.jpg[/img]
使用下面的代码调用:
使用下面的代码调用:
public static void main(String[] args){
List worker = new ArrayList();
worker.add(new Robber());
worker.add(new Teacher());
worker.add(new Student());
Iterator it = worker.iterator();
while(it.hasNext()){
((Work)it.next()).execute();
}
}