title: Constructor initialization Vs assignment
body: <p>Let us consider the following classes</p>
  <pre><code>class test1
  {
      private:
          int a;
          int b;
      public:
          test1():a(0),b(0){}
  };
  
  class test2
  {
      private:
          int a;
          int b;
      public:
          test2()
          {
              a=0;
              b=0;
          }
  };
  </code></pre>
  <p>Now, I know that <code>test1()</code> constructor is the right way to initialize the data members of a <code>class</code>, because in <code>test2()</code> we are performing assignment and not initialization. My questions are:</p>
  <ol>
  <li>What might go wrong if we perform assignment instead of initialization?</li>
  <li>Doesn't the compiler internally perform assignment in case of <code>test1()</code> constructor? If not, then how are these initialized?</li>
  </ol>