include/TestBullet.h:12: error: expected constructor, destructor, or type conver
sion before ( token
我对C++错误信息...... lo
基本上,Im 沿用了以下文字:,该员额试图为子弹制造一个工厂,以便它们能够从铺面上,从一个Xml文档中穿透,因为我不想让所有类别的班子都转机。
这里是我的测试手册。
#pragma once
#include "Bullet.h"
#include "BulletFactory.h"
class TestBullet : public Bullet {
public:
void init(BulletData& bulletData);
void update();
};
REGISTER_BULLET(TestBullet); <-- line 12
我的推土机:h
#pragma once
#include <string>
#include <map>
#include "Bullet.h"
#define REGISTER_BULLET(NAME) BulletFactory::reg<NAME>(#NAME)
#define REGISTER_BULLET_ALT(NAME, CLASS) BulletFactory::reg<CLASS>(NAME)
template<typename T> Bullet * create() { return new T; }
struct BulletFactory {
typedef std::map<std::string, Bullet*(*)()> bulletMapType;
static bulletMapType map;
static Bullet * createInstance(char* s) {
std::string str(s);
bulletMapType::iterator it = map.find(str);
if(it == map.end())
return 0;
return it->second();
}
template<typename T>
static void reg(std::string& s) {
map.insert(std::make_pair(s, &create<T>));
}
};
提前感谢。
并且与错误无关,但是,在不造成吨错误的情况下(由于循环包容)让“推土机”包括“推土机”还是有办法? 这样,我就能够从所有子弹子流顶上删除<条码>。