我有两个类的问题,每个类需要知道其头文件中的另一个.
#ifndef STRUCTURE_H
#define STRUCTURE_H
#include <vector>
#include "Sprite.h"
#include "Bullet.h"
class Structure: public Sprite{
public:
Structure(const BITMAP bm, const Vec2& pos, const Vec2& vel,
const RECT boundaries, std::vector<std::vector<bool>> holes);
virtual ~Structure() = 0;
void takeDamage(const Bullet* bullet);
protected:
std::vector<std::vector<bool>> mBulletHoles;
};
#endif
Run Code Online (Sandbox Code Playgroud)
#include "Structure.h"
Structure::Structure(const BITMAP bm, const Vec2& pos, const Vec2& vel,
const RECT boundaries, std::vector<std::vector<bool>> holes)
:Sprite(bm, pos, vel, boundaries),
mBulletHoles(holes)
{}
void Structure::takeDamage(const Bullet* bullet){
}
Sprite::~Sprite(){}
Run Code Online (Sandbox Code Playgroud)
#ifndef BULLET_H
#define BULLET_H
#include "Animate.h" …Run Code Online (Sandbox Code Playgroud)