title: Unable to define a class that is declared publicly in another class (and more problems)
body: <p>I am making a program in which one two classes are very intimately related, and so I would like to declare one of them inside of the other one so the user has to use the Class::member syntax to create and derive from this class type. I have abstracted my program to just 4 classes and recreated the errors. The classes are :</p>
  
  <pre><code>GraphInterface, Graph, GraphIteratorInterface, and GraphIterator.
  </code></pre>
  
  <p>Where Graph derives publically from it's interface and likewise with the iterators. Now because the iterators can only be used with these graphs, I want the user to have to create one by going </p>
  
  <pre><code>Graph&lt;int&gt;::GraphIterator&lt;int&gt; it;
  </code></pre>
  
  <p>I'm trying to accomplish this by declaring the GraphIteratorInterface class inside of GraphInterface class, then defining it a separate .h file. I then declare GraphIterator inside of the Graph class (which derives from GraphInterface), then define it in it's own cpp file as normal. </p>
  
  <p>Code is here on ideone : <a href="http://ideone.com/3fByCl" rel="nofollow">http://ideone.com/3fByCl</a> 
  When I try and run everything I get the error </p>
  
  <pre><code>"error: too few template-parameter-lists class GraphInterface&lt;V&gt;::GraphIteratorInterface {" 
  </code></pre>
  
  <p>among other errors. I don't understand how it would be missing template parameters, I definitely gave it one (V).</p>
  
  <p>edit - code is here</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  template&lt;class V&gt;
  class GraphInterface {
      public:
      // Abstract GraphIterator class, defined elsewhere
      template&lt;class VE&gt; class GraphIteratorInterface;
  
      virtual ~GraphInterface();
  
      // BFS that uses the graph iterator class to perform work on the discovered
      // vertices and edges
      virtual void BFS(V src_vertex, GraphIteratorInterface&lt;V&gt; *) = 0;
  
  };
  
  template&lt;class V&gt;
  class Graph : public GraphInterface&lt;V&gt; {
      public :
      template&lt;class VE&gt; class GraphIterator; // implements the graph-iter interface
  
      ~Graph();
  
      void BFS(V src_vertex, GraphIterator&lt;V&gt; *);
  };
  
  template&lt;class V&gt;
  class GraphInterface&lt;V&gt;::GraphIteratorInterface {
  
      virtual void examine_edge(/*Edge Object*/) = 0;
      virtual void discover_vertex(const V &amp;) = 0;
      // ...
  };
  
  template&lt;class V&gt;
  class Graph&lt;V&gt;::GraphIterator : public GraphInterface&lt;V&gt;::GraphIteratorInterface {
      std::vector&lt;V&gt; vertices;
      //.. other members not in the interface
      void examine_edge(/*Edge Object*/);
      void discover_vertex(const V &amp;)
  };
  
  int main() {
      Graph&lt;int&gt; g;
      return 0;
  }
  </code></pre>