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

    <tfoot id='fs9NP'></tfoot>

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

        &amp;(*similarObject) 和similarObject 之间的区别?他们不一样吗?

        Difference between amp;(*similarObject) and similarObject? Are they not same?(amp;(*similarObject) 和similarObject 之间的区别?他们不一样吗?)
        1. <tfoot id='brqjw'></tfoot>

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

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

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

                  本文介绍了&amp;(*similarObject) 和similarObject 之间的区别?他们不一样吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  谁能给我解释一下

                  dynamic_cast<SomeObject *>( &(*similarObject) );
                  

                  做一个解引用指针的地址有什么意义?指针本身不就是它的地址吗?

                  What is the point of doing the address of a dereferenced pointer? Wouldn’t the pointer itself just be the address of it?

                  推荐答案

                  可能是 similarObject 的类型重载了 operator* 所以它返回了地址您正在传递给 dynamic_cast.

                  It may be that the type of similarObject has overloaded operator* and so it returns something whose address you're passing to dynamic_cast.

                  &(*x)x 可能不总是一样的.例如,考虑迭代器:

                  &(*x) and x may not be always the same thing. For example, think of iterator:

                  std::map<int, int>::iterator it = v.begin();
                  

                  那么 it&(*it) 是两个不同的东西:

                  Then it and &(*it) are two different thing:

                  • it的类型是std::map::iterator
                  • &(*it) 的类型是 std::pair*
                  • The type of it is std::map<int, int>::iterator
                  • The type of &(*it) is std::pair<int,int>*

                  他们完全不同.您的代码片段也可能发生类似的事情.

                  They're not at all same. Similar thing may happen with your code-snippet as well.

                  这篇关于&amp;(*similarObject) 和similarObject 之间的区别?他们不一样吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Constructor initialization Vs assignment(构造函数初始化 Vs 赋值)
                  Is a `=default` move constructor equivalent to a member-wise move constructor?(`=default` 移动构造函数是否等同于成员移动构造函数?)
                  Has the new C++11 member initialization feature at declaration made initialization lists obsolete?(声明时新的 C++11 成员初始化功能是否使初始化列表过时了?)
                  Order of constructor call in virtual inheritance(虚继承中构造函数调用的顺序)
                  How to use sfinae for selecting constructors?(如何使用 sfinae 选择构造函数?)
                  Initializing a union with a non-trivial constructor(使用非平凡的构造函数初始化联合)
                • <legend id='VDmTC'><style id='VDmTC'><dir id='VDmTC'><q id='VDmTC'></q></dir></style></legend>
                      <bdo id='VDmTC'></bdo><ul id='VDmTC'></ul>

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

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