示例#1
0
文件: Program.cs 项目: dym0080/DHMS
        static void Main(string[] args)
        {
            Secretary tongzijie = new Secretary();

            StockObserver tongshi1 = new StockObserver("张三", tongzijie);
            StockObserver tongshi2 = new StockObserver("李四", tongzijie);

            tongzijie.Attach(tongshi1);
            tongzijie.Attach(tongshi2);

            tongzijie.SecretaryAction = "老板回来了!";
            tongzijie.Notify();
            Console.ReadLine();
        }
示例#2
0
 public StockObserver(string name, Secretary sec)
 {
     this._name = name;
     this.sub   = sec;
 }