Auto-needed classes?

Posted by fsdfa on Stack Overflow See other posts from Stack Overflow or by fsdfa
Published on 2010-06-06T20:56:26Z Indexed on 2010/06/06 21:02 UTC
Read the original article Hit count: 133

Filed under:
|
|
|

Suppose I have a class A and a class B.

The .h of A, needs the .h of B, and the .h of B needs the .h of A. (need = #include).

All .h have the guards:

#ifndef _classX_
#define _classX_
...
...
#endif

But if I compile the .cpp of A, then when it includes the .h of B, the B class cannot include the .h of A class because the A class has already use the guard.

How can i solve this?

© Stack Overflow or respective owner

Related posts about c++

Related posts about class