I have a class like this one:
class Test{
public:
Test(string value);
Test(bool value);
};
If I create an object like this:
The type of "Just a test..."
is const char *
, which can be implicitly converted to either bool
or std::string
. Because std::string
isn't a built in type, the const char *
s is converted to a bool
. You can prevent that by explicitly converting the const char *
to a std::string
:
Test test(std::string("Just a test..."));