• <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ì)模式
            精品久久777| 久久亚洲国产欧洲精品一| 亚洲国产成人精品久久久国产成人一区二区三区综 | 亚洲日本久久久午夜精品| 无码任你躁久久久久久久| 久久综合噜噜激激的五月天| 91精品国产综合久久香蕉 | 无码精品久久久久久人妻中字| 国产亚洲美女精品久久久| 天天综合久久一二三区| 欧美黑人又粗又大久久久| 99热热久久这里只有精品68| 久久狠狠爱亚洲综合影院| 激情五月综合综合久久69| 久久久久精品国产亚洲AV无码 | 欧美亚洲国产精品久久高清 | 99久久99久久精品国产片果冻| 2021国产精品午夜久久| 国产精品免费看久久久香蕉| 久久夜色精品国产噜噜麻豆| 久久精品三级视频| 久久er国产精品免费观看2| 亚洲精品美女久久777777| 欧美日韩精品久久久免费观看| 久久精品国产99国产精品澳门| 亚洲伊人久久精品影院| 老色鬼久久亚洲AV综合| 久久九九久精品国产免费直播| 久久99国产精品尤物| 久久久久久久女国产乱让韩| 久久国产精品二国产精品 | 国产69精品久久久久777| 97精品伊人久久久大香线蕉| 色狠狠久久综合网| 国内精品伊人久久久影院| 久久亚洲天堂| 伊人久久大香线焦综合四虎| 国产一区二区精品久久凹凸| 国产精品嫩草影院久久| 久久精品国产一区二区三区| 亚洲а∨天堂久久精品9966|