The <fstream> header inherits the <iostream> header. So, in theory, I should be able to access the std::cout object to stream my output to the command line. My question is, how do I access it without including the <iostream> header again and then using the using namespace std statement?
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
return 0;
}
What I want to achieve:
#include <fstream>
using namespace SOMETHING HERE TO BRING COUT TO THE WORKSPACE;
int main() {
cout << "Hello, World!" << endl;
return 0;
}
Is having <iostream> redundant after having <fstream>? Does it have any effect on the final build, or will the compiler optimize this?