设计模式--代理模式
代理模式用例图
class Program { static void Main(string[] args) { Proxy proxy = new Proxy(); proxy.Request(); Console.Read(); } } abstract class Subject { public abstract void Request(); } class RealSubject : Subject { public override void Request() { Console.WriteLine("真实的请求"); } } class Proxy : Subject { RealSubject realSubject; public override void Request() { if (realSubject == null) { realSubject = new RealSubject(); } realSubject.Request(); } }