Difference Namespaces and Headers?

Searched a little on google about these subjects, but isn't giving a clear difference between them.

Found out that they both summon premade "Liberary's"
Assuming Namespaces are a lot of headers merged into 1 , but not sure about it.

So was wondering if anyone here could give me a clear difference?:)

Tx on advance.
Headers are files containing interface declarations. Those declarations are divided into different namespaces.

So a given header file may contain declarations that are contained within several different namespaces. Also several different header files may contain declarations for elements within the same namespace.

So headers are a physical way of dividing up the code and namespaces are a logical way of dividing up the code.
A namespace is a form of defense against redefinition errors. A header file is a file copied into a .cpp file.

http://cplusplus.com/doc/tutorial/namespaces/
http://en.wikipedia.org/wiki/Header_file

EDIT: Dang it.

-Albatross
Last edited on
It might be worth mentioning that namespaces are used for ADL. This logical grouping can be used for a little more than just avoiding name collisions--it can facilitate the appropriate lookup of nonmember interface functions.
Thanks a lot ^^
Topic archived. No new replies allowed.