Can you use keyword explicit to prevent automatic conversion of method parameters?

后端 未结 8 1480
心在旅途
心在旅途 2020-12-04 17:18

I know you can use C++ keyword \'explicit\' for constructors of classes to prevent an automatic conversion of type. Can you use this same command to prevent the conversion

8条回答
  •  一整个雨季
    2020-12-04 18:17

    Compiler gave "ambiguous call" warning, which will be sufficient.

    I was doing TDD development and didn't realize I forgot to implement the corresponding call in the mock object.

提交回复
热议问题