explicit-constructor

What does the explicit keyword in C++ mean?

Someone posted in a comment to another question about the meaning of the explicit keyword in C++. So, what does it mean? ...

If I use explicit constructor, do I need to put the keyword in both .h and .cpp files?

Actually my question is all in the title. Anyway: I have a class and I use explicit constructor: .h class MyClass { public: explicit MyClass(const string& s): query(s) {} private: string query; } Is it obligatory or not to put explicit keyword in implementation(.cpp) file? ...

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 char *func) { strcpy(str,func); } i call it as, myClass obj("example"); when i compile this i get the following warning: deprecated conversion from string constant to 'char*' can anyone please provide a pointer to this...

Can a single argument constructor with a default value be subject to implicit type conversion

I understand the use of the explicit keyword to avoid the implicit type conversions that can occur with a single argument constructor, or with a constructor that has multiple arguments of which only the first does not have a default value. However, I was wondering, does a single argument constructor with a default value behave the same...

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 implicit assignment What is the difference between those, if any, and in what cases do explicit and implicit assignment differ and how? http://weblogs.asp.net/kennykerr/archive/2004/08/31/Explicit-Construc...