Skip to content

Last updated:2026-10-12

C++ explicit and Explicit Conversion

About the Author

WeChat official account:

wechat

  • When explicit qualifies a constructor, it prevents implicit conversion and copy initialization
  • When explicit qualifies a conversion function, it prevents implicit conversion, except for contextual conversions

See the code at: .explicit.cpp

Reference link:

https://stackoverflow.com/questions/4600295/what-is-the-meaning-of-operator-bool-const

Comments