0
点赞
收藏
分享

微信扫一扫

C++ namespace

素的盐 2022-02-07 阅读 70
#include <iostream>

using namespace std;

namespace first_space {
    void func() {
        cout << "Inside first_space" << endl;
    }
}

namespace second_space {
    void func() {
        cout << "Inside second_space" << endl;
    }
}

using namespace first_space;

int main()
{
    func();
    return 0;
}
#include <iostream>

using namespace std;

namespace first_space {
    void func() {
        cout << "Inside first_space" << endl;
    }

    namespace second_space {
        void func() {
            cout << "Inside second_space" << endl;
        }
    }
}

using namespace first_space::second_space;

int main() {
    func();
    return 0;
}
举报

相关推荐

0 条评论