• <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 閱讀(410) 評(píng)論(0)  編輯 收藏 引用 所屬分類: C++ programme language設(shè)計(jì)模式
            久久er国产精品免费观看8| 婷婷五月深深久久精品| 99久久免费只有精品国产| 久久精品国产影库免费看| 久久免费观看视频| 日韩人妻无码一区二区三区久久| 国产精品免费看久久久| 午夜精品久久久久成人| 国产成年无码久久久久毛片| 精品视频久久久久| 久久青青草原精品国产| 久久国产乱子伦精品免费午夜| 久久精品国产亚洲AV忘忧草18| 国产精品久久久久久一区二区三区| 精品无码人妻久久久久久| 久久综合九色综合网站| 国产成人无码精品久久久免费 | 久久夜色精品国产噜噜亚洲a| 久久久无码一区二区三区| 欧美久久一区二区三区| 欧美精品一区二区精品久久| 久久夜色精品国产噜噜麻豆| 久久久久亚洲AV无码专区桃色 | 久久亚洲精品无码aⅴ大香| 国产精品久久久久久久久免费| 久久久久亚洲AV无码专区首JN | 久久―日本道色综合久久| 久久乐国产综合亚洲精品| 国产午夜精品理论片久久| 免费国产99久久久香蕉| 亚洲狠狠婷婷综合久久久久| 亚洲日本va午夜中文字幕久久| 99久久精品国产一区二区三区| 2021少妇久久久久久久久久| 久久香综合精品久久伊人| 一本一本久久A久久综合精品 | 久久中文娱乐网| 久久精品国产秦先生| 一级做a爰片久久毛片人呢| 九九久久99综合一区二区| 久久精品国产亚洲沈樵|