示例#1
0
        public ConcreteMediator(LandlordComponent landlordComponent, TenantComponent tenantComponent)
        {
            this.landlordComponent = landlordComponent;
            this.landlordComponent.SetMediator(this);

            this.tenantComponent = tenantComponent;
            this.tenantComponent.SetMediator(this);
        }
示例#2
0
        static void Main(string[] args)
        {
            LandlordComponent landlordComponent = new LandlordComponent();
            TenantComponent   tenantComponent   = new TenantComponent();

            new ConcreteMediator(landlordComponent, tenantComponent);

            landlordComponent.DoA();

            Console.WriteLine();

            tenantComponent.DoC();

            Console.ReadKey();
        }