Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ Namespaces and header files

Tags:

c++

namespaces

I have seen codes with using namespace std;. Does it mean that if we use this then we don't have to include header files in the code or if we don't use namespaces, does it mean that we have to use std:: before every function, class?

like image 579
Sireiz Avatar asked Jun 27 '13 06:06

Sireiz


1 Answers

You have to include header files and use namespaces.

The namespaces are contained in the header files, io streams like cin,cout are contained in the namespaces.So, only if you include the header file, namespace can be used. Without using namespace std, You have to use scope resolution operator every time you use those functions.

like image 145
Aswin Murugesh Avatar answered Sep 29 '22 18:09

Aswin Murugesh