static void Main()
        {
            //tao ra doi truong Clock
            Clock theClock = new Clock();
            //tao doi tuong DisplayClock dang ki su kien va xu li su kien
            DisplayClock dc = new DisplayClock();

            dc.Subscrible(theClock);
            //bat dau thuc hien vong lap va phat sinh su kien trong moi giay
            theClock.Run();
        }
Пример #2
0
        public void Run()
        {
            // create a new clock
            Clock theClock = new Clock();

            // create the display and tell it to
            // subscribe to the clock just created
            DisplayClock dc = new DisplayClock();

            dc.Subscribe(theClock);

            // create a Log object and tell it
            // to subscribe to the clock
            LogCurrentTime lct = new LogCurrentTime();

            lct.Subscribe(theClock);

            // Get the clock started
            theClock.Run();
        }
Пример #3
0
 static void Main()
 {
     using var game = new Clock();
     game.Run();
 }