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

            留言簿(1)

            他山之石

            閱讀排行榜

            評論排行榜

            Call Super Function in the Override function of the derived class

            The derived class overrides the function in the base class. However, in some cases, we need to reuse the function of the base class in the overrided function. For C++, the scope operator is used to force a call to use a particular version of a overrided function.
            Below is the example code, this code also contains the usage of the private inheritance.


            #include "stdafx.h"

            #include 
            <iostream>
            #include 
            "stdio.h"
            #include 
            <string>
            using namespace std;

            class base 
            {
            public:
                
            void basename()
                
            {
                    cout 
            << "this is base name\n";
                }

            protected:
                
            int i;
                
            void base2ndname()
                
            {
                    cout
            <<"this is base private name\n";
                }

            }
            ;

            class private_derived:private base  //private derivation, access control updates for the user of derivated class 
            {
            public:
                
            void basename() //override the base function
                {
                    cout 
            << "this is my derived name\n";
                    
            //basename();  // This will cause the endless loop
                    this->base::basename();
                }
            ;
                
            int use_base()
                
            {
                    
            this->base::basename();  // use the scope operator to use the base class function
                    this->base::base2ndname();
                    basename();
                    
            return i;
                }

            }
            ;

            int _tmain(int argc, _TCHAR* argv[])
            {
                base base_obj;
                private_derived derive_obj;

                cout 
            << derive_obj.use_base();

            }

            posted on 2007-10-21 18:07 everspring79 閱讀(360) 評論(0)  編輯 收藏 引用 所屬分類: Notes

            久久亚洲sm情趣捆绑调教| 久久久久久夜精品精品免费啦| 精品一久久香蕉国产线看播放 | 久久精品a亚洲国产v高清不卡| 久久人人妻人人爽人人爽| 77777亚洲午夜久久多喷| 天天综合久久一二三区| 久久精品国产亚洲AV无码麻豆 | 色偷偷偷久久伊人大杳蕉| 一本色道久久88加勒比—综合| 久久亚洲熟女cc98cm| 久久天天躁狠狠躁夜夜2020| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 国产L精品国产亚洲区久久| 国产成人精品综合久久久| 欧美激情精品久久久久久| 久久国产亚洲精品麻豆| 久久久久久综合网天天| 欧洲性大片xxxxx久久久| AAA级久久久精品无码区| 精品国际久久久久999波多野| 午夜精品久久久久久影视777| 天天爽天天爽天天片a久久网| 久久久久亚洲av无码专区导航| 久久WWW免费人成一看片| 无码人妻久久一区二区三区蜜桃 | 精品久久久久久综合日本| 九九久久自然熟的香蕉图片| 无码AV中文字幕久久专区| 久久久精品国产免大香伊 | 久久中文字幕无码专区| 国产免费久久久久久无码| 国产真实乱对白精彩久久| 久久美女人爽女人爽| 国产99久久九九精品无码| 精品久久久久久国产牛牛app| 久久精品成人免费观看97| 日本亚洲色大成网站WWW久久| 偷窥少妇久久久久久久久| 久久亚洲欧美国产精品| 久久婷婷五月综合色高清|