コード例 #1
0
        // The most common applications of the Proxy pattern are lazy loading,
        // caching, controlling the access, logging, etc. A Proxy can perform
        // one of these things and then, depending on the result, pass the
        // execution to the same method in a linked RealSubject object.
        public void SendHttpRequest(string url)
        {
            if (CheckAccess())
            {
                _realSubject = new RealSubject();
                _realSubject.SendHttpRequest(url);

                LogAccess();
            }
        }
コード例 #2
0
        public double Subsctract(double value1, double value2)
        {
            double result = 0;

            if (CheckAccess())
            {
                _realSubject = new RealSubject();
                result       = _realSubject.Subsctract(value1, value2);

                LogAccess();
            }
            return(result);
        }
コード例 #3
0
 public Proxy(RealSubject realSubject)
 {
     _realSubject = realSubject;
 }