<legend id='mREWq'><style id='mREWq'><dir id='mREWq'><q id='mREWq'></q></dir></style></legend>

  1. <i id='mREWq'><tr id='mREWq'><dt id='mREWq'><q id='mREWq'><span id='mREWq'><b id='mREWq'><form id='mREWq'><ins id='mREWq'></ins><ul id='mREWq'></ul><sub id='mREWq'></sub></form><legend id='mREWq'></legend><bdo id='mREWq'><pre id='mREWq'><center id='mREWq'></center></pre></bdo></b><th id='mREWq'></th></span></q></dt></tr></i><div id='mREWq'><tfoot id='mREWq'></tfoot><dl id='mREWq'><fieldset id='mREWq'></fieldset></dl></div>

      <tfoot id='mREWq'></tfoot>

      • <bdo id='mREWq'></bdo><ul id='mREWq'></ul>

      <small id='mREWq'></small><noframes id='mREWq'>

      前置双冒号“::"是什么意思?

      时间:2023-08-26
    1. <i id='YXJEt'><tr id='YXJEt'><dt id='YXJEt'><q id='YXJEt'><span id='YXJEt'><b id='YXJEt'><form id='YXJEt'><ins id='YXJEt'></ins><ul id='YXJEt'></ul><sub id='YXJEt'></sub></form><legend id='YXJEt'></legend><bdo id='YXJEt'><pre id='YXJEt'><center id='YXJEt'></center></pre></bdo></b><th id='YXJEt'></th></span></q></dt></tr></i><div id='YXJEt'><tfoot id='YXJEt'></tfoot><dl id='YXJEt'><fieldset id='YXJEt'></fieldset></dl></div>
      • <legend id='YXJEt'><style id='YXJEt'><dir id='YXJEt'><q id='YXJEt'></q></dir></style></legend>

            <tbody id='YXJEt'></tbody>
            <bdo id='YXJEt'></bdo><ul id='YXJEt'></ul>
            <tfoot id='YXJEt'></tfoot>

            • <small id='YXJEt'></small><noframes id='YXJEt'>

              1. 本文介绍了前置双冒号“::"是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在一个必须修改的类中发现了这行代码:

                I found this line of a code in a class which I have to modify:

                ::Configuration * tmpCo = m_configurationDB;//pointer to current db
                

                而且我不知道类名前面的双冒号到底是什么意思.没有它,我会读到:tmpCo 的声明作为指向 Configuration 类的对象的指针......但是前置的双冒号让我感到困惑.

                and I don't know what exactly means the double colon prepended to the class name. Without that I would read: declaration of tmpCo as a pointer to an object of the class Configuration... but the prepended double colon confuses me.

                我还发现:

                typedef ::config::set ConfigSet;
                

                推荐答案

                这可确保从全局命名空间开始解析,而不是从您当前所在的命名空间开始.例如,如果您有两个名为 <代码>配置如下:

                This ensures that resolution occurs from the global namespace, instead of starting at the namespace you're currently in. For instance, if you had two different classes called Configuration as such:

                class Configuration; // class 1, in global namespace
                namespace MyApp
                {
                    class Configuration; // class 2, different from class 1
                    function blah()
                    {
                        // resolves to MyApp::Configuration, class 2
                        Configuration::doStuff(...) 
                        // resolves to top-level Configuration, class 1
                        ::Configuration::doStuff(...)
                    }
                }
                

                基本上,它允许您遍历全局命名空间,因为您的名称可能会被另一个命名空间内的新定义破坏,在本例中为 MyApp.

                Basically, it allows you to traverse up to the global namespace since your name might get clobbered by a new definition inside another namespace, in this case MyApp.

                这篇关于前置双冒号“::"是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:c++ 将枚举值标记为已弃用? 下一篇:之前的常量还是之后的常量?

                相关文章

              2. <legend id='W1UIH'><style id='W1UIH'><dir id='W1UIH'><q id='W1UIH'></q></dir></style></legend>
                  <i id='W1UIH'><tr id='W1UIH'><dt id='W1UIH'><q id='W1UIH'><span id='W1UIH'><b id='W1UIH'><form id='W1UIH'><ins id='W1UIH'></ins><ul id='W1UIH'></ul><sub id='W1UIH'></sub></form><legend id='W1UIH'></legend><bdo id='W1UIH'><pre id='W1UIH'><center id='W1UIH'></center></pre></bdo></b><th id='W1UIH'></th></span></q></dt></tr></i><div id='W1UIH'><tfoot id='W1UIH'></tfoot><dl id='W1UIH'><fieldset id='W1UIH'></fieldset></dl></div>

                1. <small id='W1UIH'></small><noframes id='W1UIH'>

                  • <bdo id='W1UIH'></bdo><ul id='W1UIH'></ul>
                    <tfoot id='W1UIH'></tfoot>