-
"old style" header files
hey, hope y'all are having a fine evening :) so i'm reading my new book (deitel&deitel--much better than the idiot's guide, btw) and it talks about the standard library header files. what happened to the .h's. what's the difference, ad/disadvantages?
to use them you just do
Code:
#include namespace std
right? nothing else different?
-
The main difference is that the standard files use the std namespace while the old ones dont so they pollute the global namespace of your app which can cause naming conflicts. And to use them you just include the header you want not namespace std; To use them you include the header then do any of the methods of using things from a namespace ex:
Code:
#include<iostream>
#include<string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
// Or you could include it all doing:
using namespace std;