What is namespace in C++?
In this chapter of C++ interview questions, we will learn about:
-
what is namespace in c++?
-
syntax of namespace in c++
-
application of namespace in C++
Namespace in C++ meaning
Namespace was introduced by ANSI C++ standard committee. A namespace is used to define the scope of identifiers on the program. It also organizes code in groups, so that no name collision takes place.
In C++, the global namespace is the main. It has some features like:
-
Multiple blocks with the same namespace are allowed.
-
A namespace can be present in a nested way.
-
Namespace doesn't need any semicolon after the bracket closes, also it doesn't require an access specifier.
Syntax of namespace in C++
namespace namespace_name
{
/* Coding Area */
}
Application of namespace in C++:
using namespace std;
The using namespace is there to that the member defined in std namespace will be used frequently.
Would you like to see your article here on tutorialsinhand.
Join
Write4Us program by tutorialsinhand.com
About the Author
Page Views :
Published Date :
Jan 18,2021