<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      C++中的繼承

      #include <iostream>
      class A{
          public:
              std::string head;
              void hello(std::string str){
                  std::cout<<str<<head<<std::endl;
              }
      };
      
      int main()
      {
         A a;
         std::string str="hello";
         a.head="888";
         a.hello(str);
         return 0;
      }

      寫起來和java差不多,不同的地方在于這里是A a;java是A a=new A();

      #include <iostream>
      class A{
          public:
              std::string head;
              void hello(std::string str){
                  std::cout<<str<<head<<std::endl;
              }
      };
      class B : public A{
          
      };
      int main()
      {
         B a;
         std::string str="hello";
         a.head="888";
         a.hello(str);
         return 0;
      }

      這就是繼承 C++直接用" : "表示了后面要public

      C++構造器

      #include <iostream>
      class A{
          public:
              A(){
                  printf("construction\n");
                  
              };
              ~A(){
                  printf("end construction\n");
      
              };
          
              std::string head;
              void hello(std::string str){
                  std::cout<<str<<head<<std::endl;
              }
      };
      class B : public A{
          public:
              B(){
                  printf("B construction\n");
      
              };
              ~B(){
                  printf("end B construction\n");
      
              };
          
      };
      int main()
      {
         B a;
         std::string str="hello";
         a.head="888";
         a.hello(str);
         return 0;
      }

      看一下輸出,一看就能看懂很簡單

      construction
      B construction
      hello888
      end B construction
      end construction

       

      posted on 2023-04-16 13:29  Z_Chan  閱讀(14)  評論(0)    收藏  舉報

      導航

      主站蜘蛛池模板: 色爱综合激情五月激情| 桃花岛亚洲成在人线AV| 日本一区二区三区专线| 一区二区三区精品偷拍| 国产一卡2卡三卡4卡免费网站| 色视频不卡一区二区三区| 国产成人av性色在线影院| 精品国产成人一区二区| 亚洲国产成人精品无码区在线观看| 亚洲精品无amm毛片| caoporn免费视频公开| 国产成人精品性色av麻豆| 国产品精品久久久久中文| 日韩熟女熟妇久久精品综合| 亚洲天堂av在线一区| 日韩一区二区三区无码a片| 无码国产69精品久久久久网站 | 欧美一区内射最近更新| 无码h片在线观看网站| 国产精品久久国产精品99 gif| 亚洲 日韩 国产 制服 在线| 天堂在线www天堂中文在线| av在线播放无码线| 男男车车的车车网站w98免费| 国产精品疯狂输出jk草莓视频| 免费人成视频在线播放| 亚洲av午夜福利大精品| 中文字幕亚洲综合久久青草| 天堂资源国产老熟女在线| 久久成人国产精品免费软件| 九九久久人妻精品一区色| 称多县| 你懂的视频在线一区二区| 伽师县| 国产亚洲国产亚洲国产亚洲| 天天弄天天模| 国产精品日韩中文字幕熟女| 义乌市| 亚洲永久精品免费在线看| 国产精品中文字幕av| 伊人久久大香线蕉AV网禁呦|