What is the difference between header file and namespace? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between header file and namespace?

21st Oct 2016, 3:18 AM
Al Xayeed
Al Xayeed - avatar
2 Answers
+ 2
In a header file, there is definition of many entities that is needed for programming. A namespace can discriminate the entities of a header file. For example if we want to have two classes with a same name in a same header file, we must have two namespaces and declare that classes in different namespaces.
21st Oct 2016, 3:55 AM
Morteza
+ 1
ow thnq 😊
21st Oct 2016, 5:41 AM
Al Xayeed
Al Xayeed - avatar