public static void Main(string[] args) { IMobileFactory mobileFactory = new XiaomiFactory(); IMobile mobile = mobileFactory.GetMobile(ModelType.RedmiPro); mobile.GetMobile(); }
public static ISmartphoneFactory GetSmartphoneFactory(SmartphoneFactoryType type, ILogger logger) { ISmartphoneFactory factory = null; switch (type) { case SmartphoneFactoryType.AppleFactory: factory = new AppleFactory(logger); break; case SmartphoneFactoryType.SamsungFactory: factory = new SamsungFactory(logger); break; case SmartphoneFactoryType.XiaomiFactory: factory = new XiaomiFactory(logger); break; default: break; } return(factory); }