示例#1
0
        public override void Request()
        {
            // Use 'lazy initialization'
            if (_realSubject == null)
            {
                _realSubject = new RealSubject();
            }

            _realSubject.Request();
        }
示例#2
0
 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();
 }