title: When constructing a derived class which defines a base class member of some large type, how should I pass the value?
body: <p>Suppose I have 3 classes: <code>Base</code>, <code>Derived</code> and <code>Chunky</code>. <code>Derived</code> is derived from <code>Base</code>, and <code>Base</code> has a member of type <code>Chunky</code> (<code>Chunky</code> is large, and I don't want to copy it unless I have to).</p>
  
  <p>Here is <code>Base</code>, assume that we <em>cannot</em> change it in any way (no, we can't create a constructor for it):</p>
  
  <pre><code>class Base
  {
  public:
    Chunky monkey;
  }
  </code></pre>
  
  <p><code>Derived</code> looks something like this:</p>
  
  <pre><code>class Derived : public Base
  {
    // option 1
    Derived(Chunky const&amp; monkey)
    {
      this-&gt;monkey = monkey;
    }
  
    // option 2
    Derived(Chunky monkey)
    {
      // does this do anything useful, or am I wasting my time by calling std::move?
      this-&gt;monkey = std::move(monkey);
    }
  }
  </code></pre>
  
  <p>I like option 2 better because the intent is clearer and I don't have to create a reference value, but do we still have the benefit of <code>std::move</code> when <code>monkey</code> can't be initialised in constructor initializer list? How would <em>you</em> solve this problem (again assuming <code>Base</code> can't change)?</p>
  
  <p>In case anyone wants to know, <em>monkey</em> in this case is an std::function, and <a href="https://stackoverflow.com/questions/8711391/should-i-copy-an-stdfunction-or-can-i-always-take-a-reference-to-it">this discussion</a> didn't really answer my question.</p>