标签:http 技术 interface stat atp static 准备 oid int
package demo2;
interface IEat{
void get();
}
class EatReal implements IEat{
public void get() {
System.out.println("[真实主题类]得到一份食物,然后开始品尝美味");
}
}
class EatProxy implements IEat {
private IEat eat;
public EatProxy(IEat eat) {
this.eat = eat;
}
public void prepare() {
System.out.println("[代理主题类]准备吃");
}
public void get() {
this.prepare();
this.eat.get();
this.clean();
}
public void clean() {
System.out.println("[代理主题类]收拾碗筷");
}
}
public class ProxyTest {
public static void main(String[] args) {
IEat eat = new EatProxy(new EatReal());
eat.get();
}
}
标签:http 技术 interface stat atp static 准备 oid int
原文地址:https://www.cnblogs.com/PengeStudy/p/10280886.html