[問題] constructor assignment與initializer

看板C_and_CPP作者 (poppopjack)時間7年前 (2017/10/29 04:42), 編輯推噓1(100)
留言1則, 1人參與, 7年前最新討論串1/2 (看更多)
開發平台(Platform): (Ex: Win10, Linux, ...) Win10 編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出) VC++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 小弟有以下疑惑: C++的constructor可以用assignment和initializer兩種寫法,不知道有沒有大神能夠解釋或是說明什麼情況用initializer較佳或assignment較佳,感謝! 餵入的資料(Input): 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) 補充說明(Supplement): ----- Sent from JPTT on my Samsung SM-G930F. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.217.164.77 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1509252179.A.C6A.html

11/03 22:59, 7年前 , 1F
你是想問copy-init跟direct-init嗎
11/03 22:59, 1F
文章代碼(AID): #1PzLnJng (C_and_CPP)
文章代碼(AID): #1PzLnJng (C_and_CPP)