There is often a processing method for complex software systems, that is, adding an indirect layer, so that the system can obtain a more flexible solution to meet specific needs. In an object-oriented system, some objects require high overhead for some reason, such as object creation, security control for some operations, or access outside the process, direct access may cause a lot of trouble to the user or system structure. The Proxy design pattern is to manage and control the unique complexity of these objects by adding an indirect layer without losing transparent operation objects. [Cpp] // Proxy. h # include <string> # include <iostream> # include <string> class IEmployee {public: virtual string get_name (int ID) = 0; virtual int get_age (int ID) = 0; virtual double get_salary (int ID) = 0; public: virtual ~ IEmployee () ;}; IEmployee ::~ IEmployee () {cout <"in the destructor of IEmployee... "<endl;} class Employee: public IEmployee {public: string get_name (int ID); int get_age (int ID); double get_salary (int ID );~ Employee () ;}; string Employee: get_name (int ID ){//... assume that the database is queried here and the name of the Employee corresponding to the ID is string name = "tom"; return name;} int Employee: get_age (int ID ){//... assume that the database is queried here and the age int age = 20; return age;} double Employee: get_salary (int ID ){//... assume that the database is queried here and the Employee's salary corresponding to the ID is double salary = 100000.00; return salary;} Employee ::~ Employee () {cout <"in the destructor of Employee... "<endl ;}// proxy class EmployeeProxy: public IEmployee {public: string get_name (int ID); int get_age (int ID); double get_salary (int ID );~ EmployeeProxy () ;}; string EmployeeProxy: get_name (int ID ){//... assume that the get_name (int ID) method in the Employee is accessed through socket or RPC, And the return value string name = "tom"; return name;} int EmployeeProxy :: get_age (int ID ){//... assume that the get_age (int ID) method in the Employee is accessed through socket or RPC, and the corresponding return value int age = 20; return age;} double EmployeeProxy :: get_salary (int ID ){//... assume that the get_salary (int ID) side of the Employee is accessed through socket, RPC, and other methods. And accept the corresponding return value double salary = 100000.00; return salary;} EmployeeProxy ::~ EmployeeProxy () {cout <"in the destructor of EmployeeProxy... "<endl;} // Proxy. cpp # include "Proxy. h "int main (int argc, char ** argv) {IEmployee * employee = new EmployeeProxy; cout <employee-> get_name (10) <endl; cout <employee-> get_age (10) <endl; cout <employee-> get_salary (10) <endl; delete employee; return 0 ;}