title: Nested class inside an abstract class
body: <p>I have an abstract class like so:</p>
  
  <pre><code>class A
  {
  public:
      void func() = 0;
  };
  </code></pre>
  
  <p>Can I force its implementations to have a nested iterator class too?</p>
  
  <pre><code>#include &lt;iterator&gt;
  
  template&lt;typename T&gt;
  class A
  {
  public:
      class Iterator : public std::iterator&lt;std::forward_iterator_tag, T&gt;
      {
      };
  
      virtual Iterator begin() const = 0;
      virtual void func() = 0;
  };
  
  template&lt;typename T&gt;
  class B : public A&lt;T&gt;
  {
  public:
      B() {}
      class Iterator : public std::iterator&lt;std::forward_iterator_tag, T&gt;
      {
      };
  
      Iterator begin() const
      {
          return Iterator();
      }
  
      virtual void func()
      {
      }
  };
  
  int main()
  {
      B&lt;int&gt; b;
  }
  </code></pre>
  
  <p>I just want to know if this is possible, and if it is, what am I missing? Since the iterator class will depend on how the class A is implemented, I don't know if a formal implementation is possible.</p>