【发布时间】:2014-10-04 17:10:35
【问题描述】:
我的SystemManager 有一个System 类的映射,其中每个系统都映射到systype 类型
typedef string systype;
在头文件中,声明了这个map:
class SystemManager
{
public:
SystemManager();
~SystemManager();
map<systype, System> systems;
System* getSystemPointer(systype);
};
我尝试在构造函数中将DrawSystem(派生自System 的类)添加到我的“系统映射”中:
SystemManager::SystemManager()
{
systems["Draw"] = DrawSystem();
}
这给了我错误:
不能将归档的“
pair<systype, System>::second”声明为抽象类型系统
我不知道是什么原因造成的。
这是我的System 和DrawSystem 课程,以防万一:
class System
{
public:
System();
systype type;
vector<cptype> args;
virtual void update(vector<Cp*>) = 0; //= 0 is for pure virtual function
};
class DrawSystem : public System
{
friend class Game; //allows to draw on render window
public:
DrawSystem();
void update(vector<Cp*>);
};
【问题讨论】:
标签: c++ abstract-class virtual abstract pure-virtual