mirror of
https://github.com/huihut/interview.git
synced 2024-03-22 13:10:48 +08:00
25 lines
629 B
C++
25 lines
629 B
C++
|
//
|
||
|
// Created by xiemenghui on 2018/7/20.
|
||
|
//
|
||
|
|
||
|
#include "Factory.h"
|
||
|
#include "concrete_factory.h"
|
||
|
|
||
|
Factory* Factory::CreateFactory(FACTORY_TYPE factory)
|
||
|
{
|
||
|
Factory *pFactory = nullptr;
|
||
|
switch (factory) {
|
||
|
case FACTORY_TYPE::BENZ_FACTORY: // 奔驰工厂
|
||
|
pFactory = new BenzFactory();
|
||
|
break;
|
||
|
case FACTORY_TYPE::BMW_FACTORY: // 宝马工厂
|
||
|
pFactory = new BmwFactory();
|
||
|
break;
|
||
|
case FACTORY_TYPE::AUDI_FACTORY: // 奥迪工厂
|
||
|
pFactory = new AudiFactory();
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
return pFactory;
|
||
|
}
|