<分区>
Possible Duplicate:
Is there any difference between type casting & type conversion?
我个人交替使用术语cast 和conversion。那是对的吗?如果不是,有什么区别?
<分区>
Possible Duplicate:
Is there any difference between type casting & type conversion?
我个人交替使用术语cast 和conversion。那是对的吗?如果不是,有什么区别?
最佳答案
我不认为它们是相同的——强制转换导致编译器执行显式转换,但您也可以进行隐式转换,例如
double d = 23; // implicit conversion from int to double
对比:
int i = static_cast<int>(23.0); // explicit conversion from double to int
关于c++ - *cast* 和 *conversion* 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4167407/