title: Avoiding implicit conversion in constructor. The 'explicit' keyword doesn't help here
body: <p>I am able to avoid the implicit conversion of a constructor using the <code>explicit</code> keyword. So now, conversions like <code>A a1 = 10;</code> can be avoided.</p>
  
  <p>But still I can initialize <code>A a1 = A(20.2);</code>. How can I disable the object creation such that an object can only be created if we pass an integer as a parameter e.g. <code>A a1 = A(10)</code>?</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class A
  {
  public:
      explicit A(int a)
      {
          num = a;
      }
  
      int num;
  };
  
  int main()
  {
      A a1 = A(10.0);
      std::cout &lt;&lt; a1.num;
      return 0;
  }
  </code></pre>