0
What are namespaces ?
why we use......using namespace std;....??
5 Respostas
+ 1
a namespace is items used to set objects so they can be used over again by name. Namespace std makes it to where we don't have to write std::cout when trying to print or std::cin when wanting someone to input.
+ 1
yes
+ 1
Namespaces are a way of preventing so called "name collision", i.e. multiple *definition* (not necessarily declaration) of the same symbol.
This can occur in projects that are bigger than these presented here at SoloLearn C++ as homonyms become more likely to occur. A term is a homonym if this term is used in different meanings. It's the opposite of synonyms which denote different words for the same meaning.
An example: the word "bow" can mean the thing you use to play a violin or a (medieval) weapon. You could want to write a, let's say, role-playing game set in the middle ages.
Then you might want to model in your code the weapon *and* the music utility. In order to distinguish between the weapon and the music utility without changing the name of the classes, you put one bow class in the namespace music and the other in the namespace weapon.
0
object oriented programme
0
Can namespaces be applied to importing a function and not a library?