久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='Y5leX'></tfoot>
      <i id='Y5leX'><tr id='Y5leX'><dt id='Y5leX'><q id='Y5leX'><span id='Y5leX'><b id='Y5leX'><form id='Y5leX'><ins id='Y5leX'></ins><ul id='Y5leX'></ul><sub id='Y5leX'></sub></form><legend id='Y5leX'></legend><bdo id='Y5leX'><pre id='Y5leX'><center id='Y5leX'></center></pre></bdo></b><th id='Y5leX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Y5leX'><tfoot id='Y5leX'></tfoot><dl id='Y5leX'><fieldset id='Y5leX'></fieldset></dl></div>

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

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

          <bdo id='Y5leX'></bdo><ul id='Y5leX'></ul>

      1. C++ catch 塊 - 按值或引用捕獲異常?

        C++ catch blocks - catch exception by value or reference?(C++ catch 塊 - 按值或引用捕獲異常?)

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

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

            <bdo id='vxbdL'></bdo><ul id='vxbdL'></ul>

                  <legend id='vxbdL'><style id='vxbdL'><dir id='vxbdL'><q id='vxbdL'></q></dir></style></legend>
                    <tbody id='vxbdL'></tbody>
                  本文介紹了C++ catch 塊 - 按值或引用捕獲異常?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  可能的重復:
                  在 C++ 中通過指針捕獲異常

                  我總是按值捕獲異常.例如

                  I always catch exceptions by value. e.g

                  try{
                  ...
                  }
                  catch(CustomException e){
                  ...
                  }
                  

                  但我遇到了一些用 catch(CustomException &e) 代替的代碼.這是 a) 好的 b) 錯誤的 c) 灰色區(qū)域嗎?

                  But I came across some code that instead had catch(CustomException &e) instead. Is this a)fine b)wrong c)a grey area?

                  推薦答案

                  C++ 中異常的標準做法是......

                  The standard practice for exceptions in C++ is ...

                  按值拋出,按引用捕獲

                  在繼承層次結構面前,按值捕獲是有問題的.假設對于您的示例,還有另一種類型 MyException 繼承自 CustomException 并覆蓋錯誤代碼等項目.如果拋出 MyException 類型,您的 catch 塊將導致它被轉換為一個 CustomException 實例,這將導致錯誤代碼發(fā)生變化.

                  Catching by value is problematic in the face of inheritance hierarchies. Suppose for your example that there is another type MyException which inherits from CustomException and overrides items like an error code. If a MyException type was thrown your catch block would cause it to be converted to a CustomException instance which would cause the error code to change.

                  這篇關于C++ catch 塊 - 按值或引用捕獲異常?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  In what ways do C++ exceptions slow down code when there are no exceptions thown?(當沒有異常時,C++ 異常會以何種方式減慢代碼速度?)
                  Why catch an exception as reference-to-const?(為什么要捕獲異常作為對 const 的引用?)
                  When and how should I use exception handling?(我應該何時以及如何使用異常處理?)
                  Scope of exception object in C++(C++中異常對象的范圍)
                  Catching exceptions from a constructor#39;s initializer list(從構造函數(shù)的初始化列表中捕獲異常)
                  Difference between C++03 throw() specifier C++11 noexcept(C++03 throw() 說明符 C++11 noexcept 之間的區(qū)別)
                      <bdo id='hWgn3'></bdo><ul id='hWgn3'></ul>

                        <tbody id='hWgn3'></tbody>
                    • <i id='hWgn3'><tr id='hWgn3'><dt id='hWgn3'><q id='hWgn3'><span id='hWgn3'><b id='hWgn3'><form id='hWgn3'><ins id='hWgn3'></ins><ul id='hWgn3'></ul><sub id='hWgn3'></sub></form><legend id='hWgn3'></legend><bdo id='hWgn3'><pre id='hWgn3'><center id='hWgn3'></center></pre></bdo></b><th id='hWgn3'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='hWgn3'><tfoot id='hWgn3'></tfoot><dl id='hWgn3'><fieldset id='hWgn3'></fieldset></dl></div>
                    • <small id='hWgn3'></small><noframes id='hWgn3'>

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

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

                            主站蜘蛛池模板: 综合久久久久 | 亚洲欧洲一区二区 | 精品国产一区二区三区久久狼黑人 | 91在线中文字幕 | 国产亚洲精品精品国产亚洲综合 | 91免费在线视频 | 午夜男人的天堂 | 国产精品美女一区二区三区 | 成人午夜免费在线视频 | 日本一区二区三区免费观看 | 亚洲高清中文字幕 | 欧美成年网站 | 91精品国产欧美一区二区 | 国产一区二区三区视频在线观看 | 成人国产a | 久久久久久国产精品 | 欧美美女二区 | 日韩中文在线观看 | 成人福利影院 | 国产农村妇女精品一区 | 9久9久9久女女女九九九一九 | 欧美一区二区三区在线看 | 国产精品精品视频一区二区三区 | 9色视频在线 | 亚洲一区电影 | 国产一级在线 | 欧美一级片在线看 | 免费看日韩视频 | 日本亚洲一区 | 国产精品久久久久久吹潮 | 国产精品毛片 | 国产美女福利在线观看 | 欧美一区永久视频免费观看 | 五月天国产在线 | 三级成人在线 | av中文字幕在线观看 | www国产精| 一二三四在线视频观看社区 | 久久久91 | 国产日韩欧美91 | 日韩电影一区二区三区 |