static void Main(string[] args) { IHardwareFactory hardwareFactory = null; hardwareFactory = new HighPerformanceHardwareFactory(); IProcessor processor = hardwareFactory.ProcessorModel(); IRam ram = hardwareFactory.RAMModel(); IHdd hdd = hardwareFactory.HDDModel(); processor.IntegrateProcessor(); ram.IntegrateRAM(); hdd.IntegrateHDD(); Console.WriteLine("-----------------------"); hardwareFactory = new FairPriceHardwareFactory(); processor = hardwareFactory.ProcessorModel(); ram = hardwareFactory.RAMModel(); hdd = hardwareFactory.HDDModel(); processor.IntegrateProcessor(); ram.IntegrateRAM(); hdd.IntegrateHDD(); }
public Controller(IList <IHardware> hardwares, IList <ISoftware> softwares, IHardwareFactory hardwareFactory, ISoftwareFactory softwareFactory) { this.hardwares = hardwares; this.hardwareFactory = hardwareFactory; this.softwareFactory = softwareFactory; }