// main2.cc P. Conrad, 5/16/05
// test overloaded = operator

#include "acct.h"
#include "acctList.h"

#include <iostream>
#include <fstream>

using namespace std;


int main()
{
  AcctList_C acctList1; // default constructor makes empty list
  
  Acct_C *p; // a pointer with which to allocate new accounts from heap
  p = new Acct_C(101,"Nixon");
  acctList1.addAccount(*p);
  
  p = new Acct_C(102,"Kennedy");
  acctList1.addAccount(*p);
  
  p = new Acct_C(103,"Ford");
  acctList1.addAccount(*p);
  
  cout << "Here is acctList1:" << endl;
  acctList1.printAllAccounts(cout);
  cout << endl << endl;
  
  {
    AcctList_C acctList2 = acctList1; // uses copy constructor
    
    acctList2.addAccount(Acct_C(501,"Roosevelt"));
    cout << endl << endl;

    cout << "Here is acctList2 (same as acctList1 plus Roosevelt):" << endl;
    acctList2.printAllAccounts(cout);
    cout << endl << endl;

    
    cout << "Destructor should be called on acctList2 next";
  }

  cout << endl;
  cout << "Here is acctList1 (should be same as before):" << endl;
  acctList1.printAllAccounts(cout);
  cout << endl << endl;
  
  return 0;

}







