<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > C++含參數(shù)函數(shù)的繼承方法

          C++含參數(shù)函數(shù)的繼承方法

          作者: 時(shí)間:2016-12-01 來源:網(wǎng)絡(luò) 收藏
          方法:先繼承類然后映射函數(shù)。

          #include

          本文引用地址:http://www.ex-cimer.com/article/201612/324433.htm

          class animal
          {
          public:
          animal(char thename);

          };

          animal::animal(char thename)
          {
          char name;
          cout<}

          class pig:public animal //先繼承類,并在次寫上子類映射函數(shù)
          {
          public:
          pig(char thename);
          };

          pig::pig(char thename):animal(thename) //后映射函數(shù)。注意父類函數(shù)此時(shí)無需再定義數(shù)據(jù)類型
          {
          }

          class turtle:public animal
          {
          public:
          turtle(char thename);
          };

          turtle::turtle(char thename):animal(thename)
          {
          }
          int main()
          {
          pig st(M);
          turtle sm(n);
          return 0;
          }



          評(píng)論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();