// intarray.cpp - demo for CS 32 // cmc, 11/2/2011 #include #include "intarray.h" using namespace std; ostream& operator<< (ostream &out, const IntArray &array) { out << "["; for (int i=0; i= 0 && position < length) return values[position]; else return 0; // not such a good idea, but okay for now } void IntArray::set(int position, int value) { if (position >= 0 && position < length) values[position] = value; } IntArray& IntArray::operator= (const IntArray &right) { cout << "assignment op: object @ " << this; if (this != &right) { if (length != right.length) { cout << ", deleting data[" << length << "] @ " << values; delete [] values; length = right.length; values = new int[length]; } for (int i=0; i