public MyApp() { IBalconyFactory balconyFactory1 = new BalconyType1Factory(); IBalcony balcony1 = balconyFactory1.CreateBalcony(); balcony1.GetName(); IBalconyFactory balconyFactory3 = new BalconyType3Factory(); IBalcony balcony3 = balconyFactory3.CreateBalcony(); balcony3.GetName(); }
public MyApp(IBalconyFactory balconyFactory) { _balconyFactory = balconyFactory; IBalcony balcony1 = _balconyFactory.CreateBalcony(TypeBalcony.Type1); balcony1.GetName(); IBalcony balcony2 = _balconyFactory.CreateBalcony(TypeBalcony.Type2); balcony2.GetName(); IBalcony balcony3 = _balconyFactory.CreateBalcony(TypeBalcony.Type3); balcony3.GetName(); IBalcony balcony4 = _balconyFactory.CreateBalcony(TypeBalcony.Type4); balcony4.GetName(); }