title: Template vs pure virtual function
body: <p>I have an <code>enum class Type</code>. If I have a base class and a derived class like this:</p>
  <pre><code>template&lt;Type T&gt;
  class Templated
  {
  public:
      Type GetType() const
      {
          return T;
      }
  };
  
  class DerivedTemplated : public Templated&lt;Type::None&gt;
  {
  };
  </code></pre>
  <p>Is this better in any way than having this:</p>
  <pre><code>class NoTemplate
  {
  public:
      virtual Type GetType() const = 0;
  };
  
  class DerivedNoTemplate : public NoTemplate
  {
  public:
      Type GetType() const override { return Type::None; }
  };
  </code></pre>
  <p>Using templates is not necessary in this case, but I don't know if I should use them or not. I often store polymorphic collections of the base class, so in the templated case I would have to create an interface:</p>
  <pre><code>class ITemplated
  {
  public:
      virtual Type GetType() const = 0;
  };
  </code></pre>
  <p>and derive <code>Templated</code> from it. Are there any benefits to the templated one over the pure virtual function?</p>