public interface Subject {
void doSomething();
}
public class RealSubject implements Subject{
public void doSomething(){
//todo someting
}
}
public class ProxyObject implements Subject{
private Subject subject;
public ProxyObject(Subject subject) {
this.subject =subject;
}
public void doSomething(){
subject.doSomething();
}
}
代理模式
最新推荐文章于 2024-05-30 15:09:56 发布