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

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

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

      <tfoot id='S8crQ'></tfoot>

        C4250 VC++ 警告是什么意思?

        时间:2023-10-06

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

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

                  <tbody id='Nmoui'></tbody>

                  本文介绍了C4250 VC++ 警告是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  C4250 Visual C+ 警告是什么意思在实际方面?我已阅读链接的 MSDN 页面,但我仍然不明白问题出在哪里.

                  What does C4250 Visual C+ warning mean in practical terms? I've read the linked MSDN page, but I still don't get what the problem is.

                  编译器会警告我什么,如果我忽略警告会出现什么问题?

                  What does the compiler warn me about and what problems could arise if I ignore the warning?

                  推荐答案

                  警告指出如果任何 weak 类操作依赖于 vbc 实现的虚拟操作在 dominant 中,那么这些操作可能会由于它们捆绑在菱形继承层次结构中而改变行为.

                  The warning is pointing out that if any weak class operations depend on vbc virtual operations that are implemented in dominant, then those operations might change behavior due to the fact that they are bundled in a diamond inheritance hierarchy.

                  struct base {
                     virtual int number() { return 0; } 
                  };
                  struct weak : public virtual base {
                     void print() { // seems to only depend on base, but depends on dominant
                        std::cout << number() << std::endl;
                     }
                  };
                  struct dominant : public virtual base {
                     int number() { return 5; }
                  };
                  struct derived : public weak, public dominant {}
                  
                  int main() {
                     weak w; w.print();    // 0
                     derived d; d.print(); // 5
                  }
                  

                  这是标准指定的行为,但有时程序员可能会感到惊讶,weak::print 操作行为已经改变不是因为上面或下面的重写方法层次结构,但由继承层次结构中的同级类调用,当从 derived 调用时.请注意,从 derived 的角度来看,它是完全合理的,它调用的操作依赖于在 dominant 中实现的虚方法.

                  That is the behavior that the standard specifies, but it might be surprising for the programmer at times, the weak::print operation behavior has changed not because of an overridden method above or below in the hierarchy, but by a sibling class in the inheritance hierarchy, when called from derived. Note that it makes perfect sense from the derived point of view, it is calling an operation that depends on a virtual method implemented in dominant.

                  这篇关于C4250 VC++ 警告是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:C++ 删除不会释放所有内存(Windows) 下一篇:在字符串文字中展开宏

                  相关文章

                  最新文章

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

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

                  1. <tfoot id='j4flS'></tfoot>