void Start() { //The factories we can choose from _CarFactory US_Factory = new USFactory(); _CarFactory China_Factory = new ChinaFactory(); //Manufacture cars _Car order1 = US_Factory.ManufactureCar(CarModels.ModelS, new List <CarExtras>() { CarExtras.DracoThruster }); FinalizeOrder(order1); _Car order2 = China_Factory.ManufactureCar(CarModels.Cybertruck, new List <CarExtras>() { CarExtras.DracoThruster }); FinalizeOrder(order2); _Car order3 = US_Factory.ManufactureCar(CarModels.Roadster, new List <CarExtras>() { CarExtras.DracoThruster, CarExtras.EjectionSeat, CarExtras.DracoThruster }); FinalizeOrder(order3); }
public static void Main() { //IElectricalFactory bulgarianFactory = new BulgarianFactory(); IElectricalFactory usFactory = new USFactory(); IFan usFan = usFactory.GetFan(); usFan.SwitchOn(); }
static void Main(string[] args) { Factory1 factory = new VNFactory(); IAdress address = factory.createAddress(); IPhone phone = factory.createPhone(); Console.WriteLine("Create Object by VNFactory"); address.Show(); phone.Show(); factory = new USFactory(); address = factory.createAddress(); phone = factory.createPhone(); Console.WriteLine("Create Object by USFactory"); address.Show(); phone.Show(); Console.ReadKey(); }