关于A中用到B, B中用到A的问题
//A.h #ifndef AH #define AH class B; class A { public: B* b; void setB(); ~A(); }; #endif
//B.h #ifndef BH #define BH #include "A.h" class B { public: A a; void haha() { } }; #endif
//A.cpp #include "A.h" #include "B.h" A::~A() { delete b; } void A::setB() { b->haha(); }