I've got a program that uses three files: main.cpp, date.h, and date.cpp. I've read that you shouldn't use the whole standard namespace if you don't have to. I also imagine that #include <iostream> being repeated again and again isn't necessary. Currently, main.cpp has
1 2 3 4 5
#include "date.h"
using std::cin;
using std::cout;
using std::string;
The date.h has
1 2 3 4
#include <iostream>
using std::istream;
using std::ostream;
And date.cpp has #include "date.h"
Does this seem to be a decent way about doing things? I know that I could probably move all of the using statements to the header file, but if that header file were to be reused in a different program that doesn't need cin, cout, or string, it'd be a waste. Now that I'm thinking about it, maybe a repeated #include <iostream> in main.cpp wouldn't be so bad bad if it has the guard, which I'm guessing it does. Anyhow, you guys know better than I do. Thanks in advance. Take care!