forked from Waleon/DesignPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfactory.h
More file actions
21 lines (17 loc) · 457 Bytes
/
factory.h
File metadata and controls
21 lines (17 loc) · 457 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef FACTORY_H
#define FACTORY_H
#include "product.h"
// 抽象工厂
class AFactory
{
public:
enum FACTORY_TYPE {
BENZ_FACTORY, // 奔驰工厂
BMW_FACTORY, // 宝马工厂
AUDI_FACTORY // 奥迪工厂
};
virtual ICar* CreateCar() = 0; // 生产汽车
virtual IBike* CreateBike() = 0; // 生产自行车
static AFactory* CreateFactory(FACTORY_TYPE factory); // 创建工厂
};
#endif // FACTORY_H