Пример #1
0
        static void Main(string[] args)
        {
            // Клиентский код.
            var subject       = new Subject();     //магазин
            var observerFirst = new FirstClient(); //Наблюдатель первый

            subject.Attach(observerFirst);

            var observerSecond = new SecondClient();//Наблюдатель второй

            subject.Attach(observerSecond);

            var observerThird = new ThirdClient();

            subject.Attach(observerThird);

            subject.NewspapperLogic();
            subject.NewspapperLogic();
            subject.JournalLogic();

            subject.Detach(observerSecond);

            subject.NewspapperLogic();
        }