dimanche 26 juin 2016

Header file vs namespace

I've a quistion regarding namesapces and header files. For example when writing this simple program:

    #include <iostream>
using namespace std;
{
 cout << "Hello, world!\n";
 return 0;
}

1- What happens when we include iostream ? and what happens if we don't include it ?

2- what happens when we use std ? and what happens if we don't use it ?

3- I'm confused as I read that namspace std includes the objects like " cout " for example. But then comes this question : what is the benifit of including the header file iostream then ?

Thanks in advance !

Aucun commentaire:

Enregistrer un commentaire