title: Insert instance of class into the vector C++
body: <p>I have created a class <code>Location</code>, which is a parent class for classes <code>City</code> and <code>Village</code>. I have a <code>vector&lt;Location&gt;</code> and now I need to insert <code>City</code> or <code>Village</code> into this <code>vector</code>. I tried for example following:</p>
  
  <pre><code>    vector&lt;Location&gt; locations;
      locations.push_back(new City("New York", 9000, 1, 2));
  </code></pre>
  
  <p>or</p>
  
  <pre><code>    vector&lt;Location&gt; locations;
      Location* loc = new City("New York", 9000, 1, 2);
      locations.push_back(loc);
  </code></pre>
  
  <p>but nothing works. Can you give me an advice, please? I'm not a C++ programmer, I'm programming in Java normally, so please help me.</p>