I have the following case:
class_a.hpp:
#include "class_b.hpp" // is this "include" mandatory?
class class_a{
private:
class_b b;
};
class_a.cpp:
#include "class_b.hpp"
//code that uses member variables and functions from class_b
class_b.hpp:
class class_b{};
Is it possible to get rid of #include "class_b.hpp"
in the class_a.hpp
? Since it is just declaration, why I can not just use forward declaration and not including it? (I tried but it was not compiled)
Of Course I have included class_b.hpp
in the class_a.cpp
.