Does it problem to have circularity? Does it means circularity?
-
if I have :
class A{ B* b; } class B{ A* a; }Is it problem?? How can I solve it if I really need this pointers?
Does this Idea will solve it?
When creating A in the constructor, I create B and send it to the constructor itself?
thank:) -
if I have :
class A{ B* b; } class B{ A* a; }Is it problem?? How can I solve it if I really need this pointers?
Does this Idea will solve it?
When creating A in the constructor, I create B and send it to the constructor itself?
thank:)@RuWex said in Does it problem to have circularity? Does it means circularity?:
Is it problem??
What problem are you talking about?
If you have the problem with header files reversely including each other then the solution is simple: forward declarations without including herder files inside other header files (include those in cpp files):// Header for A class B; // Forward declaration for class B class A{ B* b; } // Header for B class A; // Forward declaration for class A class B{ A* a; }Keep in mind: forward declarations only works if you use pointers.