• <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>
            Classes that satisfy certain conditions are allowed, but not required, to end with an Interface suffix.
            link

            Definition:

            A class is a pure interface if it meets the following requirements:

            • It has only public pure virtual ("= 0") methods and static methods (but see below for destructor).
            • It may not have non-static data members.
            • It need not have any constructors defined. If a constructor is provided, it must take no arguments and it must be protected.
            • If it is a subclass, it may only be derived from classes that satisfy these conditions and are tagged with the Interface suffix.

            An interface class can never be directly instantiated because of the pure virtual method(s) it declares. To make sure all implementations of the interface can be destroyed correctly, they must also declare a virtual destructor (in an exception to the first rule, this should not be pure). See Stroustrup, The C++ Programming Language, 3rd edition, section 12.4 for details.

            Pros: Tagging a class with the Interface suffix lets others know that they must not add implemented methods or non static data members. This is particularly important in the case of multiple inheritance. Additionally, the interface concept is already well-understood by Java programmers.

            Cons: The Interface suffix lengthens the class name, which can make it harder to read and understand. Also, the interface property may be considered an implementation detail that shouldn't be exposed to clients.

            Decision: A class may end with Interface only if it meets the above requirements. We do not require the converse, however: classes that meet the above requirements are not required to end with Interface.


            Posted on 2008-10-07 14:39 micheal's tech 閱讀(418) 評(píng)論(0)  編輯 收藏 引用 所屬分類: C++ programme language設(shè)計(jì)模式
            久久精品国产黑森林| 天天综合久久一二三区| 国内精品久久国产大陆| 久久国产精品二国产精品| 国产成人精品久久| 精品多毛少妇人妻AV免费久久| 中文字幕亚洲综合久久菠萝蜜| 7777久久久国产精品消防器材| 久久99精品国产99久久| 亚洲国产成人精品久久久国产成人一区二区三区综 | 久久婷婷五月综合97色直播| 国产∨亚洲V天堂无码久久久| 亚洲人成无码www久久久| 91精品国产色综久久| 久久午夜伦鲁片免费无码| 久久夜色精品国产www| 久久99国产精品一区二区| 三上悠亚久久精品| 久久人妻AV中文字幕| 久久久久人妻精品一区三寸蜜桃 | 无码人妻久久一区二区三区免费| 国产巨作麻豆欧美亚洲综合久久 | 中文字幕久久亚洲一区| 一级做a爰片久久毛片人呢| 亚洲AV无码1区2区久久| 久久婷婷色综合一区二区| 精品国产日韩久久亚洲| 久久亚洲视频| 一本一道久久a久久精品综合| 久久人人爽人人精品视频| 久久AAAA片一区二区| 久久人妻少妇嫩草AV无码蜜桃| 久久午夜综合久久| 日韩十八禁一区二区久久| 久久久久亚洲精品男人的天堂| 久久久久亚洲AV成人网| 国产精品久久久久乳精品爆 | 一本色综合久久| 久久久久久久久久久久久久| 色综合久久中文字幕无码| 99久久人妻无码精品系列蜜桃|