Dynamic array of objects
<p>I'm aware that I could use something called <code>std::vector</code>, but I'm afraid it's not possible because of the course restrictions. </p>

<p>I need to make a dynamic extensible array of objects. The array should grow and grow when new objects need to be stored.</p>

<p>Here is the class that the array belongs to:</p>

<pre><code>class TransactionList
{
    private:
        Transaction *trans;
        int amountTransactions;
        Transaction newTrans;

    public:
        TransactionList();
        ~TransactionList();
        void read( istream &amp;is );
        void write( ostream &amp;os );
        void add( Transaction &amp; newTrans ); 
        double totalExpenses();
        double hasPaid( string namnet );
        double isDebted( string namnet );
        //PersonList FixPersons();
 };
</code></pre>

<p>The method "void add ( Transaction &amp; newTrans )" is the one I need. And yes, I seriously have to do it pointer-style.</p>

<p>So far this method is totally incomplete and just not even close to functional. I've tried several different ways, but end up with a runtime error or just bollocks result.</p>

<pre><code>void TransactionList::add(Transaction &amp; newTrans)
{
    Transaction* tempArrPtr;

    amountTransactions++;
    trans = new Transaction[amountTransactions]
    trans[amountTransactions - 1] = newTrans;
}
</code></pre>

<p>What I want the method to do is to build an array of of Transaction-objects and grow in size while it gets more objects.</p>

<p>I hope I've written about my problem clearly and wish someone could give me a good answer.
I tried Googling, but I'm still stuck - otherwise I wouldn't have bothered asking :p</p>

<p>Also if someone could give some pointers about copy constructors, I'd be very thankful. In our course material they pretty much didn't even show what a copy constructor should look like. Just like "You need copy constuctors for deep copying, good luck!"</p>
