classProgram { staticvoidMain(string[] args) { Client client = new Client();
Console.WriteLine("Client: Executing the client code with a real subject:"); RealSubject realSubject = new RealSubject(); client.ClientCode(realSubject);
Console.WriteLine();
Console.WriteLine("Client: Executing the same client code with a proxy:"); Proxy proxy = new Proxy(realSubject); client.ClientCode(proxy); // output
// Client: Executing the client code with a real subject: // RealSubject: Handling Request.
// Client: Executing the same client code with a proxy: // Proxy: Checking access prior to firing a real request. // RealSubject: Handling Request. // Proxy: Logging the time of request. } } }