If in the form of code:
class clB; class clA { clB obj; }; typedef std::shared_ptr<clA> SHP_clA; class clB { SHP_clA pointerA; }; Will such a design work normally? What problems may occur with use?
Ps. I have definitions of these two classes in different * .h files (implementation of methods in separate * .cpp), how can I dock them correctly to each other? Now it gives an error in the clA class clA :
error C2146: syntax error : missing ';' before identifier 'obj' error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
class B, then someclB, then the mention of the identifierobjB, which is not in the source ... give a minimal example (but accurate!) That reproduces the problem. While I see the main trouble is that you declare a typeBfield inA, but thisBis an incomplete type. So you can only declare a link / pointer toB... - HarryobjBsymbol in theobjBso what kind of error can one guess. - tonal