title: Over-ridden Constructors
body: <p>I am trying to assign members of one class within the constructor of another class. But I receive error that "can't assign because members are private."
  Code is something like this :</p>
  
  <pre><code>Class Class1 {
      private:
          string name;
          string city;
  }
  
  Class Class2 {
      private: 
          string id;
          string age;
  
              Class1 var; //Class1 type variable defined.
  
      Public:    
          Class2(){   // Now I will define constructor.
  
          }
          Class2(Class1&amp;, string name1, string city1) {
              var.name = name1;     // error reported , class1 private member
              var.city = city1;     // error reported , class1 private member
          }
  }
  </code></pre>