https://img-blog.csdnimg.cn/32db9ce43ef64316a2e37a31f4cee033.gif
编程小鱼酱yu612.com,点击前往

C++工厂模式

C++ 的工厂模式




#define STACK_POS_TOP											(0x0001)
#define STACK_POS_INSIDE										(0x0002)

#define BEGIN_CELL_REGISTER \
public: \
	virtual CCell*	GetCell(ulong ulCellID) \
{ \
	switch(ulCellID) \
	{

#define CELL_REGISTER(_CellID_, _CellClass_) \
	case (_CellID_): \
		{ \
		CCell* pCell = new _CellClass_(); \
		if(pCell) \
			{ \
			pCell->SetCellID(ulCellID); \
			} \
			return pCell; \
		}

#define END_CELL_REGISTER \
	default: \
	break; \
	} \
	return NULL; \
} \
	virtual UI_RESULT	DeleteCell(CCell* pCell) \
{ \
	delete pCell; \
	return UI_SUCCESS; \
}


//工厂模式类
BEGIN_CELL_REGISTER
        CELL_REGISTER(CELLID_BOOT,                                CCell_Boot) 
END_CELL_REGISTER


posted @ 2017-01-20 10:42  鱼酱  阅读(186)  评论(0编辑  收藏  举报

https://img-blog.csdnimg.cn/32db9ce43ef64316a2e37a31f4cee033.gif
编程小鱼酱yu612.com,点击前往