title: Print all pairs in a map
body: <pre><code>PhonebookEntry pb1("olaNormann");
  pb1.add("Home","11234567");
  pb1.add("Work","11065432");
  cout &lt;&lt; pb1.getNumbers()["Home"] &lt;&lt; endl;
  cout &lt;&lt; pb1.getNumbers()["Work"] &lt;&lt; endl;
  
  map&lt;string,string&gt;::iterator it;
  for(it = pb1.getNumbers().begin(); it != pb1.getNumbers().end(); ++it){
      cout &lt;&lt; (*it).first &lt;&lt; ": " &lt;&lt; (*it).second &lt;&lt; endl;
  }
  </code></pre>
  
  <p>I have used the first two cout's to ensure that the two pairs are added properly. The code will print out the first two numbers with labels Home and Work, but fails to print both numbers in the for loop. The for loop only prints out "Home: 11234567". Can anyone see why? Below is my header file with relevant method implemented. </p>
  
  <pre><code>class PhonebookEntry{
  private:
      std::string name;
      std::map&lt;std::string, std::string&gt; numbers;
  public:
      PhonebookEntry(std::string name) : name(name){}
      std::map&lt;std::string, std::string&gt; getNumbers() const {return numbers;}
  
      void add(const std::string label,const std::string number){numbers[label] = number;}
  };
  </code></pre>