标签:
interface ISubject { void registerInterest(IObserver ob); }
interface IObserver { void Update(); }
public class Subject : ISubject { ArrayList al = new ArrayList(); public void registerInterest(IObserver ob) { al.Add(ob); } void sendNotify() { foreach(IObserver ob in al) { ob.Update(); } } void xxxxxxxxxxx() { sendNotify(); } }
public class AObserver { public void Update() { } } public class BObserver { public void Update() { } }
public static void Main() { ....... }
标签:
原文地址:http://www.cnblogs.com/yasepix/p/5006738.html