Design Pattern 7-Proxy

xiaoxiao2021-03-06  63

Using system;

namespace Pattern {public abstract class subject {public abstract void request ();} ///

/// Summary description for Class1 /// public class proxy: subject {public proxy () {//. // Todo: add constructor logic here ///} private readsubject = new readsubject (); public override void request () {before (); rs.Request (); after ();} private void before () {system. Console.WriteLine ("Proxy Subject Before Request");

Private void after () {system.console.writeline ("proxy subjectAfter request");}

PUBLIC CLASS READSUBJECT: SUBJECT {public {} public override void request () {system.console.writeline ("real subject request");}

}} // proxy mode Subject s = new proxy (); s.Request ();

转载请注明原文地址:https://www.9cbs.com/read-113101.html

New Post(0)