static void Main(string[] args) { ManagerMediator managerMediator = new ManagerMediator(); LandlordPerson landlord = new LandlordPerson(managerMediator, new Apartament { Address = "Московская 3", Price = 12000 }); landlord.Apartament.Owner = landlord; RenterPerson renter = new RenterPerson(managerMediator); managerMediator.LandlordPerson = landlord; managerMediator.RenterPerson = renter; landlord.Send("Сдаю в аренду квартиру " + "| Address: " + landlord.Apartament.Address); renter.Send("Готов арендовать квартиру!"); landlord.ToRent(renter); Console.ReadLine(); }
public void ToRent(RenterPerson renter) { mediator.ToRent(this, renter); }
public abstract void ToRent(LandlordPerson landlord, RenterPerson renter);
public override void ToRent(LandlordPerson landlord, RenterPerson renter) { landlord.Apartament.Renter = renter; renter.Apartament = landlord.Apartament; Console.WriteLine("Сделка успешно удалась!"); }