title: Should members variables used by the CRTP base type be in the derived type?
body: <p>I've been learning about CRTP (Curiously Recurring Template Pattern) today and believe I understand it well enough.</p>
  
  <p>However, in the examples I've seen the state is stored in the derived type, even though the base type relies upon their presence. To me, this seems illogical and the member variables should be in the base type since its functionality relies upon them.</p>
  
  <p><strong>Here's a simple example of what I'm talking about:</strong></p>
  
  <pre><code>template &lt;typename DerivedType&gt;
  class Base{
  public:
      int calculate() {
          return static_cast&lt;DerivedType&amp;&gt;(*this).x + static_cast&lt;DerivedType&amp;&gt;(*this).y;
      }
  };
  
  class Derived : Base&lt;Derived&gt;{
  public:
      int x; // ignore the fact that these aren't initialised for simplicity
      int y;
  };
  </code></pre>
  
  <p><strong>My question is:</strong></p>
  
  <p>Am I correct in thinking that the members <code>x</code> and <code>y</code> would be better off in the base type? If not, why?</p>