I know that similar questions have been asked before, but after doing my research, I still have questions about the circular heading.
#ifndef H_FOOA
#define H_FOOA
#include "foob.h"
class FooA{
public:
FooB *fooB;
};
#ifndef H_FOOB
#define H_FOOB
class FooA;
class FooB{
public:
FooA *fooA;
};
Now, if I have two round dependencies, this is the way I saw people on stackoverflow to get around the problem. My only problem is that in my main.cpp I have to enable fooa.h first and then foob.h
#include "fooa.h"
#include "foob.h"
#include "foob.h"
#include "fooa.h"
Now my question is: "Is there a way to forward declare these classes so that I can not worry about the order in which I include the header files in my main.cpp?"
source
share