public override void Request() { // Use 'lazy initialization' if (_realSubject == null) { _realSubject = new RealSubject(); } _realSubject.Request(); }
public override void Request() { // Use 'lazy initialization' Console.WriteLine("Proxy: We need RealSubject instance in Proxy"); if (_realSubject == null) { _realSubject = new RealSubject(); Console.WriteLine("Proxy: New RealSubject created"); } Console.WriteLine("Proxy: Call RealSubject.Request()"); _realSubject.Request(); }