For example, class A has a member of class B. In general, for the purpose of minimizing compilation dependency, we often make class A include B's pointer, and pre-declare class B in the class A's declaration. Looks like this:
//B.h
class B
{
....
};
//A.h
class B;
class A
{
B*b;
A();
...
};
//A.cpp
#include "B.h"
A::A()
{
b=new B();
...
};
But now I have a question: if the class of B is defined using typedef like this:
typedef class
{
....
}B;
The previous pre-declared method will not work in this case. How should I pre-declare the class B in A.h?