2018-07-22 14:50:54 +08:00
|
|
|
//
|
|
|
|
// 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) {
|
2020-12-16 16:07:24 +08:00
|
|
|
case FACTORY_TYPE::BENZ_FACTORY: // Benz factory
|
2018-07-22 14:50:54 +08:00
|
|
|
pFactory = new BenzFactory();
|
|
|
|
break;
|
2020-12-16 16:07:24 +08:00
|
|
|
case FACTORY_TYPE::BMW_FACTORY: // BMW factory
|
2018-07-22 14:50:54 +08:00
|
|
|
pFactory = new BmwFactory();
|
|
|
|
break;
|
2020-12-16 16:07:24 +08:00
|
|
|
case FACTORY_TYPE::AUDI_FACTORY: // Audi factory
|
2018-07-22 14:50:54 +08:00
|
|
|
pFactory = new AudiFactory();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return pFactory;
|
|
|
|
}
|