If i want a circular reference but in two different files in C++, how would I implement that?
For example
AUnit.h
#inclue <BUnit.h>
class AClass : public TObject
{
__published
BClass * B;
};
BUnit.h
#include <AUnit.h>
class BClass : public TObject
{
__published
AClass *A;
};
I can’t make it in only one file with forward declarations.
I assume you’re talking about circular dependencies.
The answer is indeed to use a forward declaration, such as:
AUnit.h
BUnit.h
You could even have a forward declaration in both header files, if you wanted.