> 本文档由 [C++那些事网站](https://light-city.github.io/stories_things/cpp-things/explicit/) 同步生成,网站版本含多语言与更新排版。 # C++ explicit 显式转换 ## 关于作者: 个人公众号: ![](https://raw.githubusercontent.com/Light-City/CPlusPlusThings/master/img/wechat.jpg) - explicit 修饰构造函数时,可以防止隐式转换和复制初始化 - explicit 修饰转换函数时,可以防止隐式转换,但按语境转换除外 代码参见:[.explicit.cpp](https://github.com/Light-City/CPlusPlusThings/tree/master/basic_content/explicit/explicit.cpp) 参考链接: > https://stackoverflow.com/questions/4600295/what-is-the-meaning-of-operator-bool-const