title: C++ segmentation fault when trying to output object functions
body: <p>I am attempting to output functions common to a set of objects that share a base class and I am having some difficulty.  When the objects are instantiated they are stored in an array and then I am attempting with the following code to execute functionality common to all the objects in this loop:</p>
  
  <pre><code>  if ( truck &lt;= v ) // all types of trucks
  </code></pre>
  
  <p>vptr is an array of objects and the functions in the loop are common to all the objects.  The code compiles fine but when I run it I get a segmentation fault when it enters this loop.  I'm fairly confident that the call to the first function in this loop is what is causing the problem.</p>
  
  <p>this is how I have instantiated the objects in a previous loop:</p>
  
  <pre><code>        vptr[ i ] = new Vehicle( sn, pc );
  </code></pre>
  
  <p>I should also mention, I'm sorry I forgot to be clear from the beginning, that in this array each object is of a different class.  They all share a base class but they are derived objects of that class.  Sorry for forgetting that probably important piece of information.</p>
  
  <p>thanks
  nmr</p>