Hy,
I'm having a bit of trouble with classes in c++. I think I know how to define them, but here's my problem:
I have declared a class Level in the file Level.h
I have defined it in Level.cpp
I've compiled these two files, and no problem.
Now I have created a class named Block, same thing: declared in Block.h and defined in block.cpp
At last I have a file named global.h which is
1 2 3
|
#pragma once
#include "Level.h"
#include "Block.h
|
This file is both included in Level.h and Block.h
Now here comes the problem:
In the block class I have a member of the type Level. I thought that I could just use this like:
1 2 3 4 5 6 7 8
|
class Block {
private:
...
Level *level;
...
public:
...
}
|
But this gives me an error and I'm pretty sure it is because it doesn't recognize the type.
So how do I make sure that the file Block.cpp knows the class Level? (I also need the reverse: members of type Block in the class Level)
Thanks for the help,
genzm
P.S.: I suppose I need to give some more code, but I will post it in the morning