Two kinds of functions allow compilers to perform such conversions:
single-argument constructors and
implicit type conversion operators. A single-argument constructor is a constructor that may be called with only one argument. Such a constructor may declare a single parameter or it may declare multiple parameters, with each parameter after the first having a default value.
An implicit type conversion operator is simply a member function with a strange-looking name: the word operator followed by a type specification. You aren't allowed to specify a type for the function's return value, because the type of the return value is basically just the name of the function.
转载于:https://www.cnblogs.com/zhtf2014/archive/2011/06/09/2076705.html
相关资源:垃圾分类数据集及代码