c++ - 原始构造函数与转换转换

标签 c++ constructor casting

<分区>

有什么区别:

long myLong;
float myFloat = (float) myLong;

和:

float myFloat = float(myLong);

最佳答案

除了语法没有区别,但在 C++ 中你真的应该使用 templated casting functions

关于c++ - 原始构造函数与转换转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2451879/

相关文章:

c++ - Windows 服务停留在启动状态

python - PyQt - Window().show() 失败,但 var = Window(); var.show() 有效吗?

c# - 与 C# 相比,C++ 中的构造函数和析构函数

Java隐式转换int到byte

c++ - QThread 奇怪的行为

c++ - 无需单例即可将 QML 与 C++ 连接

types - OCaml - 创建自定义类型的自定义类型

C++ 类型转换重载

PHP JSON API - 检测返回值的数据类型

c++ - 在 SVM opencv c++ 中标记数据