I have two classes. One is a management class, which stores a bunch of worker classes. The workers are actually a templated class.
#include "worker.h"
class Management {
private:
worker<type1> worker1;
worker<type2> worker2;
...
};
The problem arises due to the fact that the templated classes needs to use Management.
Example:
class Worker{
...
};
#include "Worker.inl"
The Worker inl file:
#include "Management.h" //Circular Dependency!
Worker::Worker(){
//Management is accessed here
Management mgmt1();
mgmt1.doSomething(); //Can't use that forward declaration!
}
...
Normally you would forward declare Management.h in the Worker header file, and call it a day. Sadly, since the class is templated, it is always going to get included.
I guess you can claim that the design is bad, since a templated class shouldn't be templated if it needs to know this sort of information, but it is what it is, and I have to work with it.
You can also view this question as a microcosm of office life.