title: C++: Inherit class from template parameter
body: <p>I recently saw the following C++ code-snippet</p>
  
  <pre><code>template &lt;class B&gt;
  class A : public B
  {
     ...
  };
  </code></pre>
  
  <p>and I am wondering in which setting such a design is good practice? </p>
  
  <p>The way I understand it, is that having the superclass as a template parameter allows users of <strong>A</strong> to choose a superclass when instantiating an object of <strong>A</strong>. </p>
  
  <p>But if this is the case, wouldn't it be better to have a common superclass <strong>C</strong> for all the classes (<strong>B</strong>) which are used as the template argument and have <strong>A</strong> extend <strong>C</strong> ?</p>