private void PrepareHardware(IAbstractFactory1 schema) { cpuApi = schema.CreateCPUApi(); mainboardApi = schema.CreateMainboardApi(); cpuApi.Calculate(); mainboardApi.InstallCPU(); }
private IMemoryApi memoryApi = null; //add for the addition of interface of IMemoryApi void PrepareHardware(IAbstractFactory2 schema) { cpuApi = (ICPUApi)schema.CreateApi(1); mainboardApi = (IMainboardApi)schema.CreateApi(2); memoryApi = (IMemoryApi)schema.CreateApi(3); cpuApi.Calculate(); mainboardApi.InstallCPU(); if (memoryApi != null) // Add For addtional interface of IMemoryApi { memoryApi.RunMem(); } }