public interface Waiter{
public void service();
}
public class Waitress implement Waiter{
@Override
public void service(){
System.out.println("服务");
}
}
public class WaitressWrapper implements Waiter{
private Waiter waiter;
public WaitressWrapper(Waiter waiter){
this.waiter = waiter;
}
public void service(){
System.out.println(“微笑…”)
waiter.service();
}
}
public void Test{
Waiter waiter = new WaitressWrapper(new Waitress)
waiter.service();
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |