I read that using directive is not encouraged in C++ saying never put using directives in header files. Why is it like that? Any hint for me?
Thanks!
using namespace x;
is a very bad idea, since you have no idea what names you are importing, even with the standard library.
However: using std::cout;
and similar statements are a very good idea, because they import symbols explicitly, and make code more readable (though it still might not be a good idea to put them in the global scope in header files).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With