Esempio n. 1
0
        static void Main(string[] args)
        {
            ChatMediator chatMediator = new ChatMediator();
            IUser        u1           = new BasicUser(chatMediator, "A");
            IUser        u2           = new PremiumUser(chatMediator, "B");

            chatMediator.AddUser(u1);
            chatMediator.AddUser(u2);

            IUser u3 = new BasicUser(chatMediator, "C");

            u3.SendMessage("Hello");
            Console.ReadKey();
        }
Esempio n. 2
0
 public BasicUser(ChatMediator chatMediator, string name)
 {
     _name         = name;
     _chatMediator = chatMediator;
 }
Esempio n. 3
0
 public PremiumUser(ChatMediator chatMediator, string name)
 {
     _name         = name;
     _chatMediator = chatMediator;
 }