隨筆-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 閱讀(1065) 評論(0)  編輯  收藏

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


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

          常用鏈接

          留言簿(2)

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 环江| 庐江县| 义马市| 共和县| 丹凤县| 洞头县| 仲巴县| 化德县| 高雄市| 玉环县| 梁河县| 青田县| 嘉鱼县| 桃园市| 呼图壁县| 商水县| 浦县| 巨野县| 扶绥县| 云浮市| 英山县| 龙门县| 临高县| 沭阳县| 韶山市| 曲阳县| 财经| 鄂尔多斯市| 连江县| 葫芦岛市| 双江| 治县。| 财经| 宁都县| 香港 | 兰西县| 友谊县| 鄂温| 延寿县| 灵川县| 东丽区|