public static IOffer CreateOffer(OfferType type) { IOffer offer = null; switch (type) { case OfferType.Rent: offer = new RentOffer(); break; case OfferType.Sale: offer = new SaleOffer(); break; } return(offer); }
public static IOffer CreateOffer(OfferType type) { IOffer offer = null; switch (type) { case OfferType.Rent: offer = new RentOffer(OfferType.Rent); break; case OfferType.Sale: offer = new SaleOffer(OfferType.Sale); break; default: throw new ArgumentException("Unsuported office type"); } return offer; }