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

            合区精品久久久中文字幕一区| 国产69精品久久久久99| 国产精品岛国久久久久| 国产精品视频久久| 久久九九青青国产精品| 久久国产视频网| 中文字幕日本人妻久久久免费| 97精品国产97久久久久久免费| 久久大香香蕉国产| 无码人妻久久一区二区三区蜜桃| 欧美精品九九99久久在观看| 青青热久久综合网伊人| 久久免费香蕉视频| 久久国产成人精品麻豆| 日产精品久久久久久久性色| 日韩美女18网站久久精品| 久久综合噜噜激激的五月天| 久久久久亚洲AV无码去区首| 久久精品a亚洲国产v高清不卡| 久久男人中文字幕资源站| 日本道色综合久久影院| 新狼窝色AV性久久久久久| 伊人久久综合精品无码AV专区 | 久久天天躁狠狠躁夜夜不卡| 亚洲午夜久久久久久噜噜噜| 99久久精品国产一区二区蜜芽| 久久精品九九亚洲精品| 久久亚洲AV成人无码软件| 一本久久免费视频| 久久国产成人| 久久亚洲中文字幕精品一区四| 久久国产精品久久| 久久久久久夜精品精品免费啦| 精品久久久一二三区| 国产精品亚洲美女久久久| 91精品国产91久久久久久蜜臀 | .精品久久久麻豆国产精品| 亚洲国产美女精品久久久久∴| 久久精品视频一| 久久精品国产亚洲AV久| avtt天堂网久久精品|