Top "Explicit-constructor" questions

In C++ prefixing the explicit keyword to the constructor prevents the compiler from using that constructor for implicit conversions.

C++ deprecated conversion from string constant to 'char*'

I have a class with a private char str[256]; and for it I have an explicit constructor: explicit myClass(const …

c++ string explicit-constructor
What's the difference between explicit and implicit assignment in C++

int value = 5; // this type of assignment is called an explicit assignment int value(5); // this type of assignment is called an …

c++ explicit-constructor
Purpose of Explicit Default Constructors

I recently noticed a class in C++0x that calls for an explicit default constructor. However, I'm failing to come …

c++ default-constructor explicit explicit-constructor
Why is explicit allowed for default constructors and constructors with 2 or more (non-default) parameters?

I understand that constructors with one (non-default) parameter act like implicit convertors, which convert from that parameter type to the …

c++ constructor explicit explicit-constructor
"More than one operator + matches these operands" error

I'm creating a Money class for a school assignment. I've defined a conversion from Money to double, I have a …

c++ operator-overloading type-conversion implicit-conversion explicit-constructor
Explicit constructor taking multiple arguments

Does making a constructor having multiple arguments explicit have any (useful) effect? Example: class A { public: explicit A( int b, …

c++ explicit-constructor
When should you use direct initialization and when copy initialization?

Is it simply preference or are there specific instances where one is necessary over another? I'm refering to the following …

c++ implicit-conversion explicit-constructor copy-initialization