What's the difference between explicit and implicit assignment in C++

前端 未结 3 1398
[愿得一人]
[愿得一人] 2020-12-16 14:04
int value = 5; // this type of assignment is called an explicit assignment
int value(5); // this type of assignment is called an implicit assignment
<
3条回答
  •  北海茫月
    2020-12-16 14:23

    They differ if a class has a constructor marked 'explicit'. Then, one of these does not work.

    Otherwise, no difference.

提交回复
热议问题