vendredi 22 juillet 2016

Header file vs namespace [on hold]

I don't understand the differences between namespaces and header files. Take this simple program, for example:

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello, world!n";
    return 0;
}

What happens when iostream is included? And what happens if it doesn't get included?

What happens when using namespace std? And what happens if we don't use it?

My confusion occurs as I read that using namespace std includes the objects like cout, for example. Then, what is the benefit of including the header file iostream?

Aucun commentaire:

Enregistrer un commentaire