title: Copy Constructor and default constructor
body: <p>Do we have to explicitly define a default constructor when we define a copy constructor for a class?? Please give reasons.</p>
  
  <p>eg: </p>
  
  <pre><code>class A 
  {
      int i;
  
      public:
             A(A&amp; a)
             {
                 i = a.i; //Ok this is corrected....
             }
  
             A() { } //Is this required if we write the above copy constructor??
  };      
  </code></pre>
  
  <p>Also, if we define any other parameterized constructor for a class other than the copy constructor, do we also have to define the default constructor?? Consider the above code without  the copy constructor and replace it with </p>
  
  <pre><code>A(int z)
  {
      z.i = 10;
  }
  </code></pre>
  
  <p>Alrite....After seeing the answers I wrote the following program.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class X
  {
      int i;
  
      public:
              //X();
              X(int ii);
              void print();
  };
  
  //X::X() { }
  
  X::X(int ii)
  {
      i = ii;
  }
  
  
  void X::print()
  {
      cout&lt;&lt;"i = "&lt;&lt;i&lt;&lt;endl;
  }
  
  int main(void)
  {
      X x(10);
    //X x1;
      x.print();
    //x1.print();
  }
  </code></pre>
  
  <p>ANd this program seems to be working fine without the default constructor.  Please explain why is this the case?? I am really confused with the concept.....</p>