コード例 #1
0
        static void Main(string[] args)
        {
            //前臺小姐童子喆
            Secretary tongzizhe = new Secretary();
            //看股票的同事
            StockObserver tongshi1 = new StockObserver("魏關奼", tongzizhe);
            StockObserver tongshi2 = new StockObserver("易管查", tongzizhe);

            //前臺記下了兩位同事
            tongzizhe.Attach(tongshi1);
            tongzizhe.Attach(tongshi2);
            //發現老闆回來
            tongzizhe.SecretaryAction = "老闆回來了!";
            //通知兩個同事
            tongzizhe.Notify();

            Console.Read();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            //前臺小姐童子喆
            Secretary tongzizhe = new Secretary();
            //看股票的同事
            StockObserver tongshi1 = new StockObserver("魏關奼", tongzizhe);
            StockObserver tongshi2 = new StockObserver("易管查", tongzizhe);

            //前臺記下了兩位同事
            tongzizhe.Attach(tongshi1);
            tongzizhe.Attach(tongshi2);
            //發現老闆回來
            tongzizhe.SecretaryAction = "老闆回來了!";
            //通知兩個同事
            tongzizhe.Notify();

            Console.Read();
        }
コード例 #3
0
 public NBAObserver(string name, Secretary sub)
     : base(name, sub)
 {
 }
コード例 #4
0
 public StockObserver(string name, Secretary sub)
     : base(name, sub)
 {
 }
コード例 #5
0
 public Observer(string name, Secretary sub)
 {
     this.name = name;
     this.sub  = sub;
 }
コード例 #6
0
 public Observer(string name, Secretary sub)
 {
     this.name = name;
     this.sub = sub;
 }
コード例 #7
0
 public StockObserver(string name, Secretary sub)
     : base(name, sub)
 {
 }
コード例 #8
0
 public NBAObserver(string name, Secretary sub)
     : base(name, sub)
 {
 }