Mode of design: Proxy mode

Source: Internet
Author: User

proxy mode , the method of accessing another proxy class (Realsubject) through a proxy class is abstracted into a interface class, also known as a subject Class (Subject).

Benefits : By accessing the methods in the proxy class, the method of implementing the class is indirectly accessed, that is, the method of the proxy class, which can enrich the extension in the proxy or the function of the original implementation method, to some extent, to understand the decoupling.

The implementation of the pattern, as stated above, has only three classes in the core, and the relationships between the three classes are shown in the class diagram:

The object A of the real topic class is constructed in the proxy class, so calling the operation method in the proxy class is called the method of A.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Mode of design: Proxy mode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.