#ifndef CLASSA_H
#define CLASSA_H
class B; // forward declaration
class A {
B* pB;
pB->B_method();
};
#endif
File: calssB.h
1 2 3 4 5 6 7 8 9 10 11
#ifndef CLASSB_H
#define CLASSB_H
class A; // forward declaration
class B {
A* pA;
pA->A_method();
};
#endif
it seems can not compile becasue pB->B_method() can not be known by class A according to "class B //forward declaration". how could i achieve this without include header file?
Thanks for your solution, problem solved. definitely call pA->A_method must be in B's member function. sorry for my mistake before.
anyway, still curious if its possible just using forward declaration??