• <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ì)模式
            色天使久久综合网天天| 亚洲国产成人久久综合一| 久久99国产精品成人欧美| 国产激情久久久久影院小草| 久久精品无码av| 婷婷久久久亚洲欧洲日产国码AV | 精品久久久久久国产三级| 久久精品亚洲精品国产欧美| 久久天天躁狠狠躁夜夜avapp| 久久精品无码一区二区无码| 99久久夜色精品国产网站| 久久久亚洲裙底偷窥综合| 婷婷综合久久狠狠色99h| 久久一本综合| 亚洲成人精品久久| 亚洲精品国产字幕久久不卡| 国产女人aaa级久久久级| 成人午夜精品无码区久久| 久久久久无码精品国产app| 久久久久国产精品熟女影院| 无码国内精品久久人妻麻豆按摩| 国产精品美女久久久久网| 人人妻久久人人澡人人爽人人精品| 日韩亚洲欧美久久久www综合网| 久久香综合精品久久伊人| 国产精品九九久久免费视频| 国产精品久久成人影院| 综合久久国产九一剧情麻豆 | 久久香综合精品久久伊人| 亚洲午夜久久久| 久久99精品久久久久久噜噜| 国产精品免费久久久久久久久| 狠狠色丁香久久婷婷综合五月| 亚洲AV无码久久精品蜜桃| 久久笫一福利免费导航 | 91精品国产综合久久久久久| 久久精品国产亚洲AV香蕉| 欧美亚洲国产精品久久| 国产精品久久久久久久人人看| 欧美午夜A∨大片久久| 久久久久久无码国产精品中文字幕|