隨筆-77  評論-5  文章-2  trackbacks-0
          class Square{
          public:
           Square(int x ) :value(x*x){
           }

          Square(const Square& other) = delete;//rule 1

          const Square & operator = (const Square& other) == delete;//rule 2
          const Square & operator = (Square&& other) = delete;//rule3 

          ..
          }

          Square s = 9; //因為s沒有初始化,會先用9 調用構造函數 Square(int x ) , 然后調用Square(const Square& other),和rule1 違背
          Square s2(8);
           s= s2;//對應rule 2
           s= Square(9);//對應 rule3 
          posted on 2019-12-31 21:11 huohuo 閱讀(1062) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2019年12月>
          24252627282930
          1234567
          891011121314
          15161718192021
          22232425262728
          2930311234

          常用鏈接

          留言簿(2)

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 应用必备| 安陆市| 彰化县| 武宁县| 师宗县| 龙川县| 上栗县| 宣威市| 安庆市| 新兴县| 深泽县| 德惠市| 宁都县| 麻江县| 拜城县| 西青区| 曲阳县| 临清市| 黄梅县| 祁阳县| 望城县| 龙山县| 罗定市| 东安县| 通辽市| 青海省| 陆丰市| 内丘县| 屏山县| 招远市| 永宁县| 安远县| 台山市| 东阳市| 合阳县| 赞皇县| 尚志市| 宝清县| 湖北省| 桃江县| 沐川县|