title: c++ - Direct and Copy Constructors
body: <pre><code>class UnusualClass
  {
      int a;
      public:
          UnusualClass(int a){std::cout&lt;&lt;"Direct initialization"&lt;&lt;std::endl;}
          UnusualClass(const UnusualClass &amp;n){std::cout&lt;&lt;"Copy initialization"; }
  };
  
  
  int main ()
  {
      UnusualClass k1(5);    //Direct initialization
      UnusualClass k2=56;   //Copy initialization
      return 0;
  }
  </code></pre>
  
  <p>Why does the compiler print out "Direct initialization" twice? I've done some research and found out that I might be getting copy constructor elision. 
  Is it possible to get two different outcomes in these two cases?
  Also, when I use <code>UnusualClass(const UnusualClass &amp;n)=delete</code> I get an error saying <code>use of deleted function 'UnusualClass::UnusualClass(const UnusualClass&amp;)</code>. Why would I get this error if it skips this constructor anyways?</p>
  
  <p>I know I can get two different outcomes by using two constructors <code>UnusualClass(int a);</code> and <code>UnusualClass(double b);</code> but this trick doesn't seem quite right.</p>