title: Object oriented programming , inheritance , copy constructors
body: <p>Suppose I have a base class <code>Person</code> and  I publicly inherit a class <code>Teacher</code> from  base class <code>Person</code>. 
  Now   in the main function I write something like this</p>
  
  <pre><code>// name will be passed to the base class constructor and 17
  // is for derived class constructor.
  Teacher object(“name”,17) ;
  Teacher object1=object; //call to copy constructor
  </code></pre>
  
  <p>Now I have not written the copy constructor for both the classes, off course the default copy constructors will be called. The Person class’s default copy constructor will first call the base class’s copy constructor.</p>
  
  <p>Now the problem is suppose I write the copy constructor for the base class only, what happens is, the default copy constructor of the derived class will call my written copy constructor. <br>
  Now suppose I write the copy constructor for both the classes . now the copy constructor of the derived class (i.e Teacher) will call the default constructor of the base class but not the copy constructor why?
  <br>
  <strong>Is only default copy constructor of the derived class can call the copy constructor of the base class automatically?</strong></p>