Пример #1
0
        static void Main(string[] args)
        {
            //创建中介、房东与租客
            HouseMediator mediator = new HouseMediator("房屋中介张先生");
            Person landlord = new Landlord("林房东", mediator);
            Person tenant = new Tenant("孙同学", mediator);

            mediator.Landlord = landlord;
            mediator.Tenant = tenant;

            //租客与房东分别发起会话  会话内容都是通过中介传递给对方的
            tenant.Send("我要租一间20平米的单间");
            landlord.Send("我这儿正好有一间,3000一个月");

            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //创建中介、房东与租客
            HouseMediator mediator = new HouseMediator("房屋中介张先生");
            Person        landlord = new Landlord("林房东", mediator);
            Person        tenant   = new Tenant("孙同学", mediator);

            mediator.Landlord = landlord;
            mediator.Tenant   = tenant;

            //租客与房东分别发起会话  会话内容都是通过中介传递给对方的
            tenant.Send("我要租一间20平米的单间");
            landlord.Send("我这儿正好有一间,3000一个月");

            Console.ReadLine();
        }