Esempio n. 1
0
        static void Main(string[] args)
        {
            // Create chatroom
            var chatroom = new Chatroom();

            // Create participants and register them
            var George = new Beatle("George");
            var Paul   = new Beatle("Paul");
            var Ringo  = new Beatle("Ringo");
            var John   = new Beatle("John");
            var Yoko   = new NonBeatle("Yoko");

            chatroom.Register(George);
            chatroom.Register(Paul);
            chatroom.Register(Ringo);
            chatroom.Register(John);
            chatroom.Register(Yoko);

            // Chatting participants
            Yoko.Send("John", "Hi John!");
            Paul.Send("Ringo", "All you need is love");
            Ringo.Send("George", "My sweet Lord");
            Paul.Send("John", "Can't buy me love");
            John.Send("Yoko", "My sweet love");

            // Wait for user
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Chatroom    chatroom = new Chatroom();
            Participant George   = new Beatle("George");
            Participant Paul     = new Beatle("Paul");
            Participant Ringo    = new Beatle("Ringo");
            Participant John     = new Beatle("John");
            Participant Yoko     = new NonBeatle("Yoko");

            chatroom.Register(George);
            chatroom.Register(Paul);
            chatroom.Register(Ringo);
            chatroom.Register(John);
            chatroom.Register(Yoko);
            Yoko.Send("John", "Hi John!");
            Paul.Send("Ringo", "All you need is love");
            Ringo.Send("George", "My sweet Lord");
            Paul.Send("John", "Can't buy me love");
            John.Send("Yoko", "My sweet love");
            Console.ReadKey();
        }