Hello,
I have a class in ClassManager.h declared as follows:
Code:
#include "DebugWriter.h"
class OutputManager : public DebugWriter {
The class uses DebugWriter class defined in DebugWriter.h.
The compiler runs fine, and all intended effects of DebugWriter is working. Now I have a new classes defined as follows:
Code:
#include "DebugWriter.h"
class BMManager : public DebugWriter {
Once added I have class DebugWriter redefiniton error. I got rid of the error after adding #ifndef.
Question:
I am trying to understand how the compiler runs the pass. I am thinking it needs to compile
step 1: compiler compiles OutputManager.cpp to OutputMaqnger.o and does it that by loading up OutputManger.cpp, then loads up OutManager.h and then loads DebugWriter.h.
Step 2:
compiler compiles BMManager.cpp to BMManager.o and does it that by loading up BMManger.cpp, then loads up BMManager.h and then loads DebugWriter.h.
Step 3: The .o objects is linked to become .exe
Question:
In step 2, the compiler should have no prior knowledge that DebugWriter class is defined. Why would it says redefined??