title: usage of explicit keyword for constructors
body: <p>I was trying to understand the usage of explicit keyword in c++ and looked at this question on SO
  <a href="https://stackoverflow.com/questions/121162">What does the explicit keyword mean in C++?</a></p>
  
  <p>However, examples listed there (actually both top two answers) are not very clear regarding the usage. For example,</p>
  
  <pre><code>// classes example
  #include &lt;iostream&gt;
  using namespace std;
  
  class String {
  public:
      explicit String(int n); // allocate n bytes to the String object
      String(const char *p); // initializes object with char *p
  };
  
  String::String(int n)
  {
      cout&lt;&lt;"Entered int section";
  }
  
  String::String(const char *p)
  {
      cout&lt;&lt;"Entered char section";
  }
  
  int main () {
  
      String mystring('x');
      return 0;
  }
  </code></pre>
  
  <p>Now I have declared String constructor as explicit, but lets say if I dont list it as explicit, if I call the constructor as,</p>
  
  <pre><code>String mystring('x');
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>String mystring = 'x';
  </code></pre>
  
  <p>In both cases, I will enter the int section. Until and unless I specify the type of value, it defaults to int. Even if i get more specific with arguments, like declare one as int, other as double, and not use explicit with constructor name and call it this way</p>
  
  <pre><code>String mystring(2.5);
  </code></pre>
  
  <p>Or this way</p>
  
  <pre><code>String mystring = 2.5;
  </code></pre>
  
  <p>It will always default to the constructor with double as argument. So, I am having hard time understanding the real usage of explicit. Can you provide me an example where not using explicit will be a real failure?</p>