关于C++为类增加标识符和对象DBID的解决方法

template< class Base, int TYPE_ID >

class GetClassEx: public Base

{

public:

	GetClassEx(const long _ID):ID(_ID){}

	//获取效果类型

	virtual long GetType(){ return TYPE_ID; }

	//获取效果ID

	virtual long GetEffectID(){ return ID; }

private:

	const long ID;

};

 

template< int v >

class Test{};



template<>

class Test< enEFFECT_PROPERTY >: public GetClassEx<CTmpEffect, enEFFECT_PROPERTY>

{

public:

	Test(const long ID):GetClassEx<CTmpEffect, enEFFECT_PROPERTY>(ID){}

};


你可能感兴趣的:(C++)