title: C++ VERTEX and EDGE classes don't work
body: <p>I made the class <code>vertex</code> and <code>Edge</code> for a graph but I don't understand why the <code>Edge</code>'s methods <code>GetVer1()</code> and <code>GetVer2()</code> don't work! I need to work with the pointers to the vertices for my project. Could someone help me?</p>
  
  <p><code>Vertex</code> code:    </p>
  
  <pre><code>typedef class vertex *Vertex;
  
  class vertex {
  private:
      int Key;
      list&lt;Vertex&gt; Adj;
  public:
      vertex() {}
      vertex(int k) { Key = k }
      ~vertex() {}
      void AddAdj(Vertex);
      int GetKey();
  };
  
  void vertex::AddAdj(Vertex v)
  {
      Adj.push_back(v);
  }
  
  int vertex::GetKey()
  {
      return Key;
  }
  </code></pre>
  
  <p><code>Edge</code> code:   </p>
  
  <pre><code>class Edge {
  private:
      Vertex V1;
      Vertex V2;
  public:
      Edge() {}
      ~Edge() {}
      Edge(Vertex, Vertex);
      Vertex GetVer1();
      Vertex GetVer2();
  };
  
  Edge::Edge(Vertex a, Vertex b)
  {
      V1 = a;
      V2 = b;
  }
  
  Vertex Edge::GetVer1()
  {
      return V1;
  }
  
  Vertex Edge::GetVer2()
  {
      return V2;
  }
  </code></pre>
  
  <p><code>Main</code> code:   </p>
  
  <pre><code>int main()
  {
      Vertex a(1);
      Vertex b(2);
      Edge e(a,b);
  
      Vertex v1 = e.GetVer1();
      cout &lt;&lt; v1-&gt;GetKey(); //it doesn't work!
  
      return 0;
  }
  </code></pre>