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

            国产精品99久久精品| 久久涩综合| 午夜天堂av天堂久久久| 亚洲中文字幕久久精品无码喷水| 免费精品久久天干天干| 亚洲精品无码久久一线| 久久不射电影网| 久久人人爽人人爽AV片| 久久人人爽人人人人爽AV | 久久夜色精品国产亚洲| 亚洲国产另类久久久精品黑人 | 超级97碰碰碰碰久久久久最新| 亚洲日韩中文无码久久| 久久精品国产一区| 最新久久免费视频| 久久亚洲精品视频| 7777精品久久久大香线蕉 | 成人久久精品一区二区三区| 99久久人人爽亚洲精品美女| 国产精品中文久久久久久久| 日本久久久精品中文字幕| 超级97碰碰碰碰久久久久最新| 久久综合九色综合97_久久久| 国产精品久久久久免费a∨| 国产69精品久久久久99| 亚洲成色www久久网站夜月| 深夜久久AAAAA级毛片免费看| 久久精品国内一区二区三区| 欧美国产成人久久精品| 精品久久久久久无码人妻热| 久久91精品国产91久久户| 久久天天躁狠狠躁夜夜网站| 亚洲人AV永久一区二区三区久久| 国产精品一区二区久久精品无码 | 日韩一区二区久久久久久| 伊人久久综合无码成人网 | 久久久久久久久久久久久久| 久久精品人妻一区二区三区| 99久久人人爽亚洲精品美女| 午夜不卡888久久| 国产精品免费看久久久香蕉|