Esempio n. 1
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( );
        }
Esempio n. 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();
        }