[问题] 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