title: C++ vector of base class objects
body: <p>If I have a base class and a derived class, I can create a vector of base class pointers, if I want to group multiple base and/or derived classes together in a container.</p>
  <p>Example:</p>
  <pre><code>class base
  {
  }
  
  class derived : public base
  {
  }
  
  std::vector&lt;base*&gt; group;
  </code></pre>
  <p>But is it possible to do the following?</p>
  <pre><code>std::vector&lt;base&gt; group;
  </code></pre>
  <p>ie: Without the pointers, which require <code>new</code>ing and <code>delete</code>ing?</p>
  <p>Edit: In 2015 I didn't know about polymorphism, if you are reading this question in 2022 it would be worth searching for some information about that.</p>