Actually implicit conversions really helped us.
实际上隐式转换帮了我们很大忙。
An explicit constructor cannot take part in implicit conversions.
显式构造函数不能参与隐式转换。
Implicit conversions succeed only when the process loses no data; otherwise they fail and generate a compile or run-time error.
隐含转换只在处理序不遗失资料时才会成功,否则会失败并且产生编译或执行阶段错误。
Use it to enable implicit conversions between a user-defined type and another type, if the conversion is guaranteed not to cause a loss of data.
使用它可启用使用者定义型别和其他型别之间的隐含转换,但前提是要保证转换作业不会导致资料的遗失。
However, because implicit conversions do not require programmers to explicitly cast from one type to the other, care must be taken to prevent unexpected results.
但是,因为隐式转换不需要程序员将一种类型显式强制转换为另一种类型,所以使用隐式转换时必须格外小心,以免出现意外结果。
An explicit constructor cannot take part in implicit conversions. It can only be used to explicitly construct an object. For example, with the class declared above.
外部的构造器不能参与部分的隐式转换,只能明确的构造一个对象,例如,用上面的例子。
An explicit constructor cannot take part in implicit conversions. It can only be used to explicitly construct an object. For example, with the class declared above.
外部的构造器不能参与部分的隐式转换,只能明确的构造一个对象,例如,用上面的例子。
应用推荐