Adding Names into Other Namespaces with the using Declaration - C++ Statement

C++ examples for Statement:namespace

Description

Adding Names into Other Namespaces with the using Declaration

Demo Code

#include <iostream>

using namespace std;

namespace A/*from ww  w .  ja v a2 s  . c o m*/
{
    int X;
}

namespace B
{
    using A::X;
}

int main()
{
    A::X = 2;
    cout << B::X << endl;
    return 0;
}

Result


Related Tutorials