예제 #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;
 }