[問題] deleted function error

作者: NTUTcc (鏡晨)   2017-06-17 22:11:47
開發平台(Platform): (Ex: Win10, Linux, ...)
Windows 10
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
VC++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)

問題(Question):
編譯時發生attemting to reference a delete function error
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
https://i.imgur.com/5tmxoOF.jpg
補充說明(Supplement):
Card c = Card(1); // 正確
Card cs[1];
cs[0] = Card(1); // 錯誤
為何??
作者: CoNsTaR ((const *))   2017-06-17 22:17:00
就只是像字面上說的 Card 的 operator= 是 deleted function 而已吧…Card c = Card(1) 只是單純的建構,沒有呼叫到 operator=所以沒事我記得板上有很多關於這方面的文章
作者: pttuser (pttuser)   2017-06-17 23:29:00
沒有operate= assign constructor
作者: chchwy (mat)   2017-06-18 10:04:00
你沒有給出Card的定義 是要我們猜囉?
作者: Killercat (殺人貓™)   2017-06-18 14:43:00
現代大學作業會教deleted function了?真是進步了o_O我以為大多數大學課程都停留在C++98
作者: jerryh001   2017-06-18 19:01:00
不會(至少我們系沒教) 但是用內建的東西會遇到吧
作者: Killercat (殺人貓™)   2017-06-18 20:26:00
內建碰到的機率頗低 而且原po很明顯是自己的class XD

Links booklink

Contact Us: admin [ a t ] ucptt.com