// 代理模式:使用代理对象完成用户请求,屏蔽用户对真实对象的访问
class Star {
working() {
console.log('明星开始工作');
}
}
class Adent {
constructor() {
this.star = new Star();
}
working () {
this.star.working();
}
}
class Client {
constructor () {
this.adent = new Adent();
}
main () {
this.adent.working();
}
}
const client = new Client();
client.main()
JavaScript的设计模式-代理模式
猜你喜欢
转载自blog.csdn.net/memedadexixaofeifei/article/details/103858469
今日推荐
周排行