aka Surrogate
One reason for controlling access to an object is to defer the full cost of its creation and initialization until we actually need to use it.
控制对对象的访问的一个原因是要延迟其创建和初始化的全部成本,直到我们实际需要使用它为止。即只在必要时生成开销大的对象。
Example:
An image proxy creates the real image only when the document editor asks it to display itself. The proxy forwards subsequent requests directly to the image.
只有在文档编辑器要求其显示图像时,图像代理才会创建真实的图像,代理会将后续请求直接转发到图像。
A remote proxy provides a local representative for an object in a different address space. 远程代理为一个不同地址空间中的对象提供了一个本地代表.
A virtual proxy creates expensive objects on demand. 虚拟代理在必要时创建开销大的对象.
A protection proxy controls access to the original object. 保护代理可控制对原始对象的访问.
A smart reference is a replacement for a bare pointer that performs additional actions when an object is accessed. 在访问对象时,可以执行其他操作的智能引用是裸指针的替代品。
上一篇:适大学生创业项目合大学生创业项目推荐(大学生创业新颖项目) 创业项目大学生参考比较新颖 创业项目推荐2022适合大学生创业
下一篇:深圳个人破产法规很及时 在深圳正式施行 附解读政策全文 没人注意的暴利行业 深圳市个人破产法最新政策 深圳出台个人破产法条例的意义