title: Inheritance. How to make a child = parent
body: <p>First off, I'm not totally sure how to Title my question.</p>
  
  <p>I have a question about inheritance.</p>
  
  <p>Let's say I make a class called Class_A:</p>
  
  <pre><code>class Class_A
  {
      public:
          int a;
          int b;
  };
  </code></pre>
  
  <p>Then, I make Class_B, which inherits Class_A:</p>
  
  <pre><code>class Class_B : public Class_A
  {
      public:
          int c;
          int d;
  }
  </code></pre>
  
  <p>Then I make an instance of Class_B:</p>
  
  <pre><code>Class_B my_class_b;
  </code></pre>
  
  <p>Now, I have a function that takes an instance of a Class_A, changes it, and then returns a Class_A:</p>
  
  <pre><code>Class_A func (Class_A which)
  {
      which.a += 20;
      which.b -= 20;
  
      return which;
  }
  </code></pre>
  
  <p>What I'm trying to accomplish is, I want to be able to pass any Class_A into the function, and then assign the changes back to whatever was passed into it.<br>
  I tried this:</p>
  
  <pre><code>Class_A temp = func (my_class_b);
  my_class_b = temp;
  </code></pre>
  
  <p>Passing my_class_b in for a Class_A works, but assigning it back to my_class_b doesn't.</p>
  
  <p>I get a:</p>
  
  <pre><code>no match for 'operator=' in 'my_class_b = temp'
  </code></pre>
  
  <p>What is the best way to go about doing this?  Thanks for any help.</p>