• <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>

            EverSpring working shop

            To pursue creative ideas based on nature.

            統(tǒng)計(jì)

            留言簿(1)

            他山之石

            閱讀排行榜

            評(píng)論排行榜

            Reading Notes - C++ Primer, 4th Edition

            class Sales_item {
            public:
                // operations on Sales_item objects
                double avg_price() const;
                bool same_isbn(const Sales_item &rhs) const
                    { return isbn == rhs.isbn; }
                // default constructor needed to initialize members of built-in type
                Sales_item(): units_sold(0), revenue(0.0) { }
            private:
                std::string isbn;
                unsigned units_sold;
                double revenue;
            };

            double Sales_item::avg_price() const
            {
                if (units_sold)
                    return revenue/units_sold;
                else
                    return 0;
            }
            • Const keyword used in the member function declarartion of a class definition:
              • const member may not change the data member of the objects on which it operates.
              • const should appear in both the declaration and the definition, otherwise the compliler will report the error.
            • Accesss Labels:
              • Member defined after a public label are accessible to all parts of the program. The data-abstraction view of a type is defined by its public members.
              • Member defined after a private label are not accessible to code that uses the class. The private sections encapsulate (e.g., hide) the implementation from code that uses the type.
              • For those members without the explicit access label:
                • Struct: default as public.
                • Class: default as private.
            • Internal state of the class is often designed as private. Only a member function could be responsible for the state transition error. It greatly eases the problems of maintenance and the program correctness.

            posted on 2007-10-07 16:27 everspring79 閱讀(171) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Notes

            国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 亚洲中文字幕无码久久2020| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 久久精品亚洲福利| 久久福利资源国产精品999| 欧美成人免费观看久久| 国产午夜免费高清久久影院| 精品久久久久久| 久久强奷乱码老熟女网站| 久久精品成人免费网站| 久久夜色精品国产噜噜亚洲a| 无码日韩人妻精品久久蜜桃 | 中文成人无码精品久久久不卡| 久久精品aⅴ无码中文字字幕不卡| 9999国产精品欧美久久久久久| 久久国内免费视频| 久久精品国产亚洲综合色| 亚洲中文字幕无码久久2020 | 久久国产AVJUST麻豆| 一本色道久久88加勒比—综合| 伊人久久综合无码成人网| 国产精品青草久久久久福利99| 久久精品亚洲日本波多野结衣 | 国产ww久久久久久久久久| 天堂久久天堂AV色综合| 青青青青久久精品国产h久久精品五福影院1421 | 久久狠狠一本精品综合网| 国产精品久久久久天天影视| 亚洲国产精品无码成人片久久| 欧美久久一区二区三区| 久久综合亚洲色HEZYO国产| 国产精品一区二区久久精品无码| 久久w5ww成w人免费| 久久久久久久亚洲Av无码| 亚洲国产精品无码久久98| 久久夜色精品国产噜噜亚洲AV| 伊人久久综合无码成人网| 久久w5ww成w人免费| 日韩精品国产自在久久现线拍 | 无码人妻少妇久久中文字幕| 青青久久精品国产免费看|