title: Converting child to parent object
body: <p>I will describe my problem using a dummy example. Say we have a program of this architecture:</p>
  
  <p>Parent class: Quadrilateral</p>
  
  <p>Child classes: Rectangle, Rhombus, ...</p>
  
  <p>First, a <code>vector&lt;Rectangle&gt;</code> and <code>vector&lt;Rhombus&gt;</code> are generated and make use of their child class properties. Later on, I would like to combine <em>all</em> quadrilaterals, i.e. combine both vectors into a single <code>vector&lt;quadrilateral&gt;</code>, since <em>I no longer need the child class properties</em>. Combining both vectors into one has the advantage that I can pass a reference to <code>vector&lt;quadrilateral&gt;</code> to other parts of my program where it is combined with data from other classes.</p>
  
  <p>So my question is as follows: Is it possible to make a <code>Quadrilateral</code> out of a <code>Rectangle</code> by keeping only the parent variables from the <code>Rectangle</code>? Or is this a really bad idea and is there a much more elegant way to implement this? </p>
  
  <p>EDIT:</p>
  
  <p>after learning from the answers that this is referred to as <strong>slicing</strong>, I have read about it in <a href="https://stackoverflow.com/questions/274626/what-is-object-slicing">What is object slicing?</a>. I have decided to go with Mohamad's suggestion of using vectors of pointers instead, because I think it is an elegant solution that will likely give me the best performance.</p>