+ 13

What is the purpose of a namespace?

I got a question in a challenge of C++: (Both opponents at 4-4) What is the purpose of a namespace? //By some Ben 1) access a library 2) naming a file But here, both answers are wrong as the use of a namepace is not this, and the std library is accessed using 'using'! A namespace is for scoping particular data... Eg: A's program and B's code... So, I lost 32 xp thanks to this. The question now is, how can SoloLearn approve this? Why reject my questions if you can approve incorrect ones? Help me...

21st Apr 2017, 9:19 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
8 Answers
+ 8
The question should be What is the purpose of "using namespace ..."? Then the answer will be 1. access a library.
21st Apr 2017, 10:01 AM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar
21st Apr 2017, 9:20 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 9
I know, but tell me, are those answers correct?
21st Apr 2017, 9:39 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 8
@Cyrus Ornob Corraya Yes, thats what it should be...
21st Apr 2017, 10:56 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 8
@Raletooane Yes, thats what namespaces are for... How can the creator of that quiz forget this?
21st Apr 2017, 2:53 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 6
Try again and again. There are lots of quizzes to be made. Just think, write and submit. Some might get approved. Have faith and patience.
21st Apr 2017, 9:36 AM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar
+ 6
Nope! None of those are correct. Report that question/quiz.
21st Apr 2017, 9:59 AM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar
+ 2
Namespaces provide a method for preventing name conflicts in large projects. Symbols declared inside a namespace block are placed in a named scope that prevents them from being mistaken for identically-named symbols in other scopes. Multiple namespace blocks with the same name are allowed. All declarations within those blocks are declared in the named scope. //cppreference.com
21st Apr 2017, 2:43 PM
Raletooane