C++ Circular Dependency in Header Files
问题 Is it possible to avoid circular dependency in the following header files without turning data member b1 in class A to a pointer/reference, and without relaxing the inline function requirement in class B ? A.h: #ifndef A_H #define A_H #include <B.h> // Required, as data member b1 is not a pointer/reference class A { public: B b1; // I want to keep this as as it is. int m_a; }; #endif B.h: #ifndef B_H #define B_H #include <A.h> // Required, as f() calls a member function of class A class B {