title: How to get the value from a double pointer?
body: <p>I'm trying to print the value returned by the following code:</p>
  
  <pre><code>Agent** Grid::GetAgent(int x, int y)
  {
      return &amp;agents[x][y];
  }
  </code></pre>
  
  <p>It returns a double pointer, and printing</p>
  
  <pre><code>std::cout &lt;&lt; *grid.GetAgent(j, k) &lt;&lt; endl;  
  </code></pre>
  
  <p>gives a memory locations, but when I try</p>
  
  <pre><code>std::cout &lt;&lt; **grid.GetAgent(j, k) &lt;&lt; endl; 
  </code></pre>
  
  <p>I get the error </p>
  
  <pre><code>main.cpp:53: error: no match for ‘operator&lt;&lt;’ in ‘std::cout &lt;&lt; * * grid.Grid::GetAgent(j, k)’
  </code></pre>
  
  <p>How can I print the value from *grid.GetAgent(j, k)?</p>
  
  <p>Below is the Agent.h </p>
  
  <pre><code>#ifndef AGENT_H
  #define AGENT_H
  
  
  enum AgentType { candidateSolution, cupid, reaper, breeder};
  
  class Agent
  {
  public:
      Agent(void);
      ~Agent(void);
  
      double GetFitness();
      int GetAge();
      void IncreaseAge();
      AgentType GetType();
      virtual void RandomizeGenome() = 0;
  
  protected:
      double m_fitness;
      AgentType m_type;
  private:
      int m_age;
  };
  
  #endif // !AGENT_H
  </code></pre>
  
  <p>and Agent.cpp</p>
  
  <pre><code>#include "Agent.h"
  
  
  Agent::Agent(void)
  {
      m_age = 0;
      m_fitness = -1;
  }
  
  
  Agent::~Agent(void)
  {
  }
  
  int Agent::GetAge()
  {
      return m_age;
  }
  
  double Agent::GetFitness()
  {
      return m_fitness;
  }
  
  void Agent::IncreaseAge()
  {
      m_age++;
  }
  
  AgentType Agent::GetType()
  {
      return m_type;
  }
  </code></pre>