public override void Request() { if (_realSubject == null) { _realSubject = new RealSubject(); } _realSubject.Request(); }
// 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 Request() { if (this.CheckAccess()) { this._realSubject = new RealSubject(); this._realSubject.Request(); this.LogAccess(); } }
public Proxy(RealSubject realSubject) { this._realSubject = realSubject; }