Пример #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();
 }