what is the the best practice of solving circular dependency in C++
?
I could use the forward declaration, but then I get the pointer to incomplete class type is not allowed
error. Does that mean that two classes that uses each others pointer cannot be dependent?
Also, I thought about forward declaring each class and then including every header of the solution in the main.cpp
, so it's all in one place. Would you recommend it?
A snippet from the whole project is below, so you can refer to it if the issue is better explained on an example I'm familiar with, but it would do just to be theoretical. Thanks
See Question&Answers more detail:os