• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 9, comments - 0, trackbacks - 0, articles - 0
              C++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理
            1, Declare destructors virtual in polymorphic base classes
            why ? because C++ specifies that when a derived class object is deleted through a pointer to a base class with a non-virtual destructor, results are undefined.What typically happens at runtime is that the derived part of the object is never destroyed

            2, if a class is not intended to be a base class, making the destructor virtual is usually a bad idea. 
            why?  if a class have virtual functions, it has extra overhead(vptr).

            3, In fact, many people summarize the situation this way: declare a virtual destructor in a class if and only if that class contains at least one virtual function

            4,Sometimes, however, you have a class that you'd like to be abstract, but you don't have any pure virtual functions.
            solution: declare pure virtual destructor.
            There is one twist, however you must provide a definition for the pure virtual destructor, or linker will complain.

            5, Not all base classes are designed to be used polymorphically. Neither the standard string type, for example, nor the STL container typesare designed to be base classes at all, much less polymorphic ones.


             
             

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            久久国产高清字幕中文| 久久精品无码午夜福利理论片| 青青草国产精品久久| 国产巨作麻豆欧美亚洲综合久久 | 国产美女久久精品香蕉69| 国产精品久久久久国产A级| 国产精品无码久久久久| 午夜人妻久久久久久久久| 国产99久久久国产精免费| 久久久精品人妻一区二区三区蜜桃| 无码超乳爆乳中文字幕久久| 精品一久久香蕉国产线看播放| 久久久久久久97| 久久精品二区| 久久噜噜电影你懂的| 亚洲AV日韩精品久久久久 | 国产精品久久久久蜜芽| 国产韩国精品一区二区三区久久| 无码精品久久一区二区三区| 久久久久国产一级毛片高清版| A级毛片无码久久精品免费| 久久精品国产第一区二区| 亚洲狠狠久久综合一区77777| 一本久久知道综合久久| 亚洲综合久久夜AV | 国产激情久久久久影院| 国产美女久久久| 久久久久中文字幕| 精品久久久久久亚洲精品| 亚洲精品美女久久久久99| 婷婷国产天堂久久综合五月| 久久国产精品无码网站| 99久久精品免费看国产| 亚洲国产成人久久精品动漫| 久久久噜噜噜久久中文福利| 人人狠狠综合久久88成人| 亚洲欧美伊人久久综合一区二区| 青青草原综合久久大伊人| 久久九九久精品国产免费直播| 香蕉久久夜色精品国产2020| 99精品久久久久久久婷婷|