Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 public StockObserver(string name, Secretary sec)
 {
     this._name = name;
     this.sub   = sec;
 }