I am trying to address this issues because I can not seem to find a good resource online that does so.
I do not fully understand the issue cause I never got it resolved so I will try to describe it as best as possible.
Awhile ago I had an issue where headers were being ignored because "They were called once already and therefore when they were called again by another document, it was being ignored and therefore an error was being thrown"
I never fully understood that because you can call a header more then once without errors being thrown
header1.h
#ifndef _FCLASS_
#define _FCLASS_
class firstClass {
...//declaration
}
#endif
header2.h
#ifndef _SCLASS_
#define _SCLASS_
#include "header1.h"
class SecondClass:firstClass{
...//declaration
}
#endif
header3.h
#ifndef _TCLASS_
#define _TCLASS_
#include "header1.h"
class thirdClass:firstClass{
...//declaration
}
#endif
In the above example, the header1 class was called twice, and no errors should of been thrown. Even though header1 was declared once, it could be used by multiple headers.
So my question is , in what scenarios, can a header actually be ignored by a document if it was already declared once.
Does this type of issue only apply to .cpp files that include headers ??