In your opinion, which constructor will be called?
class Element {
public:
Element(bool b = true, bool c = true);
Element(const std::string s, bool b = true, bool c = true);
};
...
Element element("something", true);
Wrong! The first.
Do I need to restart the Stroustrup book first?
I tried without const, but nothing changes.
Char * seems to be more like bool than std :: string.
With this code, everything is fine:
Element element(string("something"), true);
Compiler: Microsoft Visual C ++ 2010
OS: Windows 7
source
share