static void Main(string[] args) { Console.WriteLine("Enter car(Audi or Mercedes): "); string car = Console.ReadLine(); Factory factory = FactoryProducer.getFactory(car); ITire tire = factory.makeTire(); tire.tire(); IHeadlight headlight = factory.makeHeadlight(); headlight.headlight(); Console.ReadLine(); }
static void Main(string[] args) { //Audi Factory factory = FactoryProducer.getFactory(true); //false for Audi ITire TireOfCar = factory.makeTire(); IHeadlight HeadlightOfCar = factory.makeHeadlight(); TireOfCar.tire(); HeadlightOfCar.headlight(); //Mercedes factory = FactoryProducer.getFactory(true); //true for Mercedes TireOfCar = factory.makeTire(); HeadlightOfCar = factory.makeHeadlight(); TireOfCar.tire(); HeadlightOfCar.headlight(); Console.ReadLine(); }
public CarClient(Factory factory) { Headlight = factory.makeHeadlight(); Tire = factory.makeTire(); }