Ejemplo 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();
        }
Ejemplo n.º 2
0
 public BasicUser(ChatMediator chatMediator, string name)
 {
     _name         = name;
     _chatMediator = chatMediator;
 }
Ejemplo n.º 3
0
 public PremiumUser(ChatMediator chatMediator, string name)
 {
     _name         = name;
     _chatMediator = chatMediator;
 }