One can have Customer in one header file, possibly forward declaring Account. Account in another header file possibly forward declaring Customer. Definitions in the two cpps which can include both header files. When writing such a thing one should ask oneself whether one really needs to do it that way, though. Not that it is too much of a mess but asking such question is always good.
Re:Cyclic dependencies are evil (2013)
by sillysaurusx on Saturday January 30, 2021 @09:38PM
(#25975230)
Funny that we both think in C++. It was what popped into my head too.
AccountMgr has many Account(s). Ditto for CustomerMgr. Interact with both to taste.
Another way to think about this is, how would you do this in C++? You have header files, and they shouldn't be cyclic. Who #includes who? Well in this case it seems to me AccountService.hpp should #include CustomerService.hpp, but not the reverse. Maybe CustomerService.hpp would #include AccountID.hpp? Whatever I imagine I just don't see why you'd need cyclic #includes.