I\'m having some trouble overloading methods in C++. As an example of the problem, I have a class with a number of methods being overloaded, and each method having one parameter
The string literal "string"
has type const char[]
which can be implicity converted to bool
. This is the best conversion candidate to one of your overloaded functions although it's not likely to be the most useful one.
If your intention was to have string literals be handled by the overload taking a std::string
, then you need to add an overload taking a const char*
and make the implementation call the std::string
version.