suppose I have a header foo.h
like this:
#ifndef FOO_H
#define FOO_H
#include <string>
#include "non_standard_class.h"
std::string foo(MyClass a);
...
#endif
and the implementation foo.cpp
will be
#include <vector>
#include "foo.h"
std::string foo(MyClass a)
{
std::vector<int> x;
MyClass b;
...
}
is it a good pratice to re-include <string>
and non_standard_class.h
in foo.cpp
? The point is: if I read foo.cpp
how can I understand where does MyClass come from? I need to look at foo.h
but it will be more difficult.