As an optimisation, or to avoid include looping, a type may be forward declared, This leads to code like:
class A;
class B
{
A *a;
};
If the number of forward declaration becomes large, it can take up a lot of space at the top of the header file. Is there a way of forward declaring and using at the same time? Sort of like:
class B
{
extern A *a;
};
I've never really thought about this before, but I have a header with a bunch of forward declarations and I would like to make it tidier (without farming them off to another include file).
EDIT: I changed 'a' to a pointer, as it was rightly pointed out that you can only use forward declare on pointers and references.