title: expected nested-name-specifier error in C++
body: <p>I've written classes to implement a tree ADT that stores two sets one of edges and one of nodes. it stores them is <code>SSet</code> classes, which are an interface to use the <code>set</code> library.</p>
  <p>The outlines of the classes as well as <code>SSet.H</code> were given to us by the staff and I wrote the functions.</p>
  <p>line number 103 (function <code>GenGraphTemp::RemoveEdge</code>) the compiler (g++) tells:</p>
  <pre><code>expected nested-name-specifier before NodeEdge
  expected ',' or '...' before '&amp;' token
  ISO C++ forbids declaration of 'NodeEdge' with no type
  </code></pre>
  <p>also for the functions following <code>RemoveEdge</code> it says:</p>
  <p><code>expected ';' before &quot;const&quot;</code> for line 106</p>
  <p><code>expected ';' before &quot;SSet&quot;</code> and <code>expected ';' before &quot;const&quot;</code> for line 120</p>
  <p><code>expected ';' before &quot;friend&quot;</code> for line 134</p>
  <pre><code>#include &quot;sset.H&quot;
  
  using namespace std;
  
  #define EQ(a1,a2) (!(a1 &lt; a2) &amp;&amp; !(a2 &lt; a1))
  #define MAX(a1,a2) ((a2&lt;a1)?a1:a2)
  #define MIN(a1,a2) ((a1&lt;a2)?a1:a2)
  
  template &lt;class Node&gt;
  class Edge {
  public:
      ...
  
  protected:
      Node _start;
      Node _end;
  };
  
  
  template &lt;class Node&gt;
  class GenGraphTemp {
  public:
  
      // Adds a new node to the nodes set
      bool AddNode (const Node&amp; n1){return _nodes.Add(n1);}
      
      // Removes a node from the nodes set and all edges connected to it
      bool RemoveNode (const Node&amp; n1) {
          int edges_size = _edges.Size();
          int i;
          Edge const *epointer;
          //remove edges connected to n1
          for (i=0;i&lt;edges_size;i++){
              (((i==0)? *epointer=_edges.GetFirst(): *epointer=_edges.GetNext()));
              if (EQ(epointer-&gt;GetStart(),n1)||EQ(epointer-&gt;GetEnd(),n1)){
                  (_edges.Remove(*epointer)==false) &amp;&amp; (return false);
              }
          }
          // remove node
          return _nodes.Remove(n1);
      }
      
      // Add a new edge to the edges set
      bool AddEdge (const Node&amp; n1, const Node&amp; n2) {
          
          (EQ(n1,n2)) &amp;&amp; (return false);
  
          if ((_nodes.IsIn(n1)) &amp;&amp; (_nodes.IsIn(n2))){
              typename NodeEdge edge(n1,n2);
              return _edges.Add(edge);
          }
          return false;
      }
  
      // Removes an edge from edges set
      bool RemoveEdge (const typename NodeEdge&amp; e1) {return _edges.Remove(e1);}
  
      // Check if two nodes are connected
      bool RConnected const (const Node&amp; n1, const Node&amp; n2) {
          Edge const *epointer;
          int edges_size = _edges.Size();
          int i;
          for (i=0; i&lt;edges_size; i++){
              ((i==0)? *epointer=_edges.GetFirst(): *epointer=_edges.GetNext());
              if (EQ(epointer-&gt;GetStart(),MIN(n1,n2)) &amp;&amp; EQ(epointer-&gt;GetEnd(),MAX(n1,n2))){
                  return true;
              }
          }
      }
  
      // Return a set of all the nodes that are connected to the input node through an edge
      // if the node does not have ant neighbours, the function will return an empty set
      SSet&lt;Node&gt;* Neighbours const (const Node&amp; n1) {
          Edge const *epointer;
          int i, edge_size;
          SSet&lt;Node&gt;* neighbours = new SSet&lt;Node&gt;;
          edge_size=_edges.Size();
          for (i=0; i&lt;edges_size; i++){
              ((i==0)? *epointer=_edges.GetFirst(): *epointer=_edges.GetNext());
              if (EQ(epointer-&gt;GetStart(),n1)||EQ(epointer-&gt;GetEnd(),n1)){
                  (neighbours-&gt;IsIn(*epointer)) || (neighbours-&gt;Add(*epointer);
              }
          }
          return neighbours;
      }
  
      friend ostream&amp; operator&lt;&lt;(ostream&amp; os, GenGraphTemp&lt;Node&gt;&amp; gr)
      {
          os &lt;&lt; &quot;Nodes:\n&quot; &lt;&lt; gr._nodes &lt;&lt; &quot;Edges:\n&quot; &lt;&lt; gr._edges;
          return os;
      }
  
  
  protected:
      typedef Edge&lt;Node&gt; NodeEdge;
      SSet&lt;Node&gt; _nodes;
      SSet&lt;NodeEdge&gt; _edges;
  };
  </code></pre>
  <p>I can't understand where and what is the problem.</p>
  <h1>Edit:</h1>
  <p>I've removed the implementation of the functions and operators for the <code>Edge</code> class to cut down on lines.
  I didn't remove the implementation of the <code>GenGraphTemp</code> class because I don't know if the problem is with one of them or elsewhere.</p>
  <p>I've also tried to compile the code with each &quot;good&quot; function in remarks and it didn't help.</p>