[問題] overload operators的問題

看板C_and_CPP作者 (dd810)時間8年前 (2016/04/01 10:35), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) Xcode 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 輸出的數字跟想像中的不同 餵入的資料(Input): 3,4 6,2 預期的正確結果(Expected Output): 9,6 -3,2 錯誤結果(Wrong Output): (3,2)+(6,4)=(134516496,134516498) (3,2)-(6,4)=(134516496,134516498) 程式碼(Code):(請善用置底文網頁, 記得排版) http://ideone.com/JhXcFl -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 172.250.212.103 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1459478159.A.162.html

04/01 12:45, , 1F
建構子應該是 x= x_a; y= y_a; 才對喔
04/01 12:45, 1F

04/01 13:08, , 2F
感謝大大!!!!原來是那個小地方我沒注意到OTZ
04/01 13:08, 2F
文章代碼(AID): #1M_TwF5Y (C_and_CPP)