• <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ì)模式
            精品久久久久久无码不卡| 亚洲精品乱码久久久久久久久久久久| 久久人人妻人人爽人人爽| 亚洲国产精品高清久久久| 久久香综合精品久久伊人| 国产成人精品久久一区二区三区av | 狠狠色丁香久久婷婷综| 国产99久久久国产精品~~牛| 无码人妻少妇久久中文字幕| 久久夜色精品国产网站| 久久www免费人成看国产片| 亚洲午夜无码久久久久小说| 久久99精品久久久久久hb无码| 久久男人AV资源网站| 久久精品国产亚洲av麻豆小说 | 久久亚洲私人国产精品| 久久综合丝袜日本网| 久久人人爽人人爽人人片AV麻烦| 久久99国产精品一区二区| 99久久香蕉国产线看观香| 日本免费一区二区久久人人澡| 精品国产99久久久久久麻豆| 韩国三级中文字幕hd久久精品 | 久久夜色精品国产亚洲av| 国产精品久久久久久福利69堂| 久久夜色精品国产亚洲| 欧美久久久久久午夜精品| 久久久久四虎国产精品| 久久午夜伦鲁片免费无码| 伊人久久无码精品中文字幕| 久久久久久噜噜精品免费直播| 久久精品国产91久久麻豆自制| 久久精品国产亚洲AV无码偷窥| 成人久久免费网站| 久久精品一区二区三区AV| 久久人人爽人人爽人人爽| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 久久国产香蕉一区精品| 国产日韩欧美久久| 久久久久久国产精品无码下载| 国产日韩欧美久久|