Loading....
Coupon Accepted Successfully!

 

Nested Namespaces

It is also possible to declare a nested namespace. When one namespace is nested in another namespace, it is known as a nested namespace.

Nested namespace declaration

namespace NUM

{

statement1;

namespace NUM1

{

int k = 10;

}

statement2;

}

The variable k can be accessed using the following statements:

Variable accessing statements

cout<<NUM::NUM1::K

OR

using namespace NUM;

cout<<NUM1::k;





Test Your Skills Now!
Take a Quiz now
Reviewer Name