Trying to store an object in an array but then how to call that object's methods?
<p>I'm not a very experienced c++ coder and this has me stumped. I am passing a object (created elsewhere) to a function, I want to be able to store that object in some array and then run through the array to call a function on that object. Here is some pseudo code:</p>

<pre><code>void AddObject(T&amp; object) {
  object.action(); // this works

  T* objectList = NULL;
  // T gets allocated (not shown here) ...
  T[0] = object;
  T[0].action(); // this doesn't work
}
</code></pre>

<p>I know the object is passing correctly, because the first call to <code>object.action()</code> does what it should. But when I store object in the array, then try to invoke <code>action()</code> it causes a big crash.</p>

<p>Likely my problem is that I simply tinkered with the .'s and *'s until it compiled, <code>T[0].action()</code> compliles but crashes at runtime.</p>
