コード例 #1
0
        static void Main(string[] args)
        {
            Subject sub = new Subject();

            new Subject.HexaObserver(sub);
            new Subject.OctalObserver(sub);
            new Subject.BinaryObserver(sub);

            Console.WriteLine("First State change: 15");
            sub.setState(15);
            Console.WriteLine("Second state change: 33");
            sub.setState(33);

            Console.Read();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Subject subject = new Subject();

            new HexObserver(subject);
            new OctalObserver(subject);
            new BinaryObserver(subject);

            Console.WriteLine("First state change: 15");
            subject.setState(15);
            Console.WriteLine("Second state change: 18");
            subject.setState(18);

            Console.ReadLine();
        }