In C++, I have some header files such as: Base.h, and some classes using Base.h:
//OtherBase1.h
#include "Base.h"
class OtherBase1{
// something goes here
};
//OtherBase2.h
#include "Base.h"
class OtherBase2{
// something goes here
};
And in main.cpp, I can only use one of those two OtherBase classes because of duplicate header. If I want to use both classes, in OtherBase2.h I have to #include "OtherBase1.h" instead of #include "Base.h". Sometimes, I just want to use OtherBase2.h and not OtherBase1.h, so I think it's really weird to include OtherBase1.h in OtherBase2.h. What do I do to avoid this situation and what's the best practice for including header file?