using a classe into an other and conversely

Hello,

Here is my issue :

I create an object A, which in certain functions use an object B. So I included the header B.h in the definition of the class A. However, I also use the class A in some of the function of B, so I also included the header A.h into the class B.

I have the feeling that, when I try to compile, the compiler look at the class A, see that the class B is included, so go to see what is B, and see a declaration of the type A, and tell me :

from A.h
B.h error : 'A' has not been declared

does it seems plausible ?

thanks

See https://herbsutter.com/2013/08/19/gotw-7a-solution-minimizing-compile-time-dependencies-part-1/

It does explain/show some principles on what you have to tell the compiler.

EDIT: newer version
Last edited on
Thank you!
Topic archived. No new replies allowed.