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

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

      <tfoot id='xSmte'></tfoot>

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

        在類的構造函數中找出實例化對象

        find out instantiating object in the constructor of a class(在類的構造函數中找出實例化對象)
          • <bdo id='LvPyK'></bdo><ul id='LvPyK'></ul>
              <tbody id='LvPyK'></tbody>

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

                  <tfoot id='LvPyK'></tfoot><legend id='LvPyK'><style id='LvPyK'><dir id='LvPyK'><q id='LvPyK'></q></dir></style></legend>
                  <i id='LvPyK'><tr id='LvPyK'><dt id='LvPyK'><q id='LvPyK'><span id='LvPyK'><b id='LvPyK'><form id='LvPyK'><ins id='LvPyK'></ins><ul id='LvPyK'></ul><sub id='LvPyK'></sub></form><legend id='LvPyK'></legend><bdo id='LvPyK'><pre id='LvPyK'><center id='LvPyK'></center></pre></bdo></b><th id='LvPyK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='LvPyK'><tfoot id='LvPyK'></tfoot><dl id='LvPyK'><fieldset id='LvPyK'></fieldset></dl></div>
                  本文介紹了在類的構造函數中找出實例化對象的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  如何從 java 的構造函數中獲取實例化對象?

                  How can i get hold of the instantiating object from a constructor in java?

                  我想為某些 GUI 類存儲對父對象的引用以模擬事件冒泡 - 調用父處理程序 - 但我不想更改所有現有代碼.

                  I want to store reference to the parent object for some GUI classes to simulate event bubbling - calling parents handlers - but i dont wanna change all the existing code.

                  推薦答案

                  簡短的回答:在 Java 中沒有辦法做到這一點.(你可以找出哪個班級叫你,但下面的長答案大部分也適用于那里.)

                  Short answer: there isn't a way to do this in Java. (You can find out what class called you, but the long answer below applies there for the most part as well.)

                  長答案:根據調用位置而神奇地表現出不同的代碼幾乎總是一個壞主意.這會讓任何必須維護您的代碼的人感到困惑,并且會嚴重損害您的重構能力.例如,假設您意識到實例化對象的兩個位置具有基本相同的邏輯,因此您決定將公共位分解.驚喜!現在代碼的行為有所不同,因為它是從其他地方實例化的.只需添加參數并修復調用者.從長遠來看,它會為您節省時間.

                  Long answer: Code that magically behaves differently depending on where it's being invoked from is almost always a bad idea. It's confusing to whoever has to maintain your code, and it seriously hurts your ability to refactor. For example, suppose you realize that two of the places instantiating your object have basicaly the same logic, so you decide to factor out the common bits. Surprise! Now the code behaves differently because it's being instantiated from somewhere else. Just add the parameter and fix the callers. It'll save you time in the long run.

                  這篇關于在類的構造函數中找出實例化對象的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)

                  <small id='2XYQ1'></small><noframes id='2XYQ1'>

                1. <legend id='2XYQ1'><style id='2XYQ1'><dir id='2XYQ1'><q id='2XYQ1'></q></dir></style></legend>

                        • <bdo id='2XYQ1'></bdo><ul id='2XYQ1'></ul>
                          • <i id='2XYQ1'><tr id='2XYQ1'><dt id='2XYQ1'><q id='2XYQ1'><span id='2XYQ1'><b id='2XYQ1'><form id='2XYQ1'><ins id='2XYQ1'></ins><ul id='2XYQ1'></ul><sub id='2XYQ1'></sub></form><legend id='2XYQ1'></legend><bdo id='2XYQ1'><pre id='2XYQ1'><center id='2XYQ1'></center></pre></bdo></b><th id='2XYQ1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2XYQ1'><tfoot id='2XYQ1'></tfoot><dl id='2XYQ1'><fieldset id='2XYQ1'></fieldset></dl></div>
                          • <tfoot id='2XYQ1'></tfoot>
                              <tbody id='2XYQ1'></tbody>
                            主站蜘蛛池模板: 欧美一区二区在线 | 成人视屏在线观看 | 激情毛片 | 国产精品免费看 | 国产成人一区 | 国产精品欧美精品日韩精品 | 国产精品久久久久久久免费大片 | 欧美区在线 | 久久精品视频一区二区 | 综合久久综合久久 | 久久精品国产亚洲夜色av网站 | 欧美1区| 高清人人天天夜夜曰狠狠狠狠 | 久久久毛片 | 91国产精品在线 | 欧美一级毛片免费观看 | 国产情品 | 久久五月婷 | 成人在线日韩 | 精品美女在线观看视频在线观看 | 亚洲高清av| 成人亚洲片 | 欧美性视频在线播放 | 久久精品无码一区二区三区 | 一级片免费视频 | 中文字幕国产视频 | 日韩一区二区成人 | 日本一道本 | 成人在线观看免费 | 久久精彩视频 | 久久国产精品久久久久久久久久 | 欧美激情国产日韩精品一区18 | 国产免费一区二区三区网站免费 | 日本不卡高字幕在线2019 | 色呦呦网站 | 国产高清免费视频 | 精品欧美久久 | www.亚洲精品| 亚洲精品久久久一区二区三区 | 极品在线| 国产精品第2页 |