public static void Main(string[] args)
        {
            Subject subject = new Subject();

            new HexaObserver(subject);
            new OctalObserver(subject);
            new BinaryObserver(subject);

            Console.WriteLine("First state change: 15");
            subject.setState(15);
            Console.WriteLine("Second state change: 10");
            subject.setState(10);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Subject s = new Subject();

            new AObserver(s);
            new BObserver(s);
            new CObserver(s);

            Console.WriteLine("First state change (15)");
            s.setState(15);
            Console.WriteLine("Next change (5)");
            s.setState(5);
            Console.Read();
        }