What is the use of namespace std? Can it be replaced by another code?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the use of namespace std? Can it be replaced by another code??

4th Aug 2016, 10:26 AM
Prabhat Chandra Dwivedi
Prabhat Chandra Dwivedi - avatar
2 Answers
+ 1
namespaces are not libraries.. in a namespace you define the explicit name of properties and methods in order to use it in a short hand way... it's no madatory to use the std namespace in your programs, but if you don't then you need to use the explicit call with the :: operator for each property and method of the standard library that you import and call in your program. For example if you include the iostream library, part of the standard C++ library, but don't use the std namespace, then you will need to write std::cout to output to the standard stream.
4th Aug 2016, 11:08 AM
Nelson Urbina
Nelson Urbina - avatar
0
namespace std is a standard library in c++ which allows u to import the things required for ur program and if u dont include it u will be resulting in an error
4th Aug 2016, 10:46 AM
Suhail Pappu
Suhail Pappu - avatar