Hi,
I'm getting a compiler error with this header file:
#ifndef GAME1_H
#define GAME1_H
#include "GLGraphics.h"
#include "DrawBatch.h"
class GameComponent;
class Game1 {
private:
GLGraphics graphics;
GameComponent components;
void updateDelegates();
void Run();
};
class GameComponent {
private:
static int index;
protected:
Game1 game;
public:
GameComponent();
GameComponent(Game1 game);
void Update(int);
void Dispose();
};
class DrawableGameComponent: public GameComponent
{
private:
GLGraphics graphics;
DrawBatch drawBatch;
public:
DrawableGameComponent();
DrawableGameComponent(Game1);
void Draw();
};
#endif
I see the problem is that Game1 needs the full definition of GameComponent, and that GameComponent needs the full definition of Game1. I had way too much trouble having these in separate headers, so that's why they're together. Is there any way I can do this without completely changing the implementation of one of the classes?
Thanks!