I have a code like this (C++):
namespace models
{
class model
{
private:
ui::window* win;
};
}
namespace ui
{
class window
{
private:
models::model* modl;
};
}
As you can see its such a shout-rising hell. As you well know this code doesn’t compile, unless I provide a forward declaration for window before models, which is not rational to do so in general, since the above is not the entire code and also the code will be expanding.
Is there a systematic approach to this?
Actually, it is. You should use forward declarations instead of inclusions or full definitions wherever possible.
But most important, your design looks awckward at least.
EDIT: Per request, code with forward declarations: