C++ C++;使用

C++ C++;使用,c++,namespaces,using,short,C++,Namespaces,Using,Short,我可以使用撤消命令吗 我所想的示例代码: #include <iostream> using namespace std; namespace one { void write() { cout << "write:one" << endl; } } namespace two { void write() { cout << "write:two" << endl;

我可以使用撤消命令吗

我所想的示例代码:

#include <iostream>
using namespace std;

namespace one {
    void write() {
        cout << "write:one" << endl;
    }
}

namespace two {
    void write() {
        cout << "write:two" << endl;
    }
}

void write() {
    cout << "write:write" << endl;
}

int main() {
    one::write();
    two::write();
    using one::write;
    write();    //And it's called from namespace one witch is correct
                //but now i want to call a global method and how i can do that.
    return 0;
}
#包括
使用名称空间std;
名称空间1{
无效写入(){

cout您不能使用
指令撤消
。但是您可以使用全局命名空间中的名称和
。例如

::write();

我删除了BASIC标记,因为它与这个主题没有任何关系,并且BASIC编程语言在搜索时给出了误报。