------------------------------------------------------------------------------
MC logo
Object Copy Demo
[^] CSc 220 Home
------------------------------------------------------------------------------
[Introduction] [Boolean and Control] [Functions] [Arrays and Pointers] [Dynamic Arrays] [Array Errors] [Command Array] [Standard Containers] [Structs and Classes] [Automatic Pointer] [Multi-File Programs] [Copying Objects] [Templates] [Inheritance] [Plain C I/O] [Type Odds And Ends] [Plain C Strings] [File I/O]
[Safe Integer Array Class] [Safe Integer Array Implementation] [Bounds Error Demo] [Object Copy Demo] [No Copies For Me, Please] [Hidden Calls]
sauser.cpp
#include <iostream>
#include "safearr.h"

using namespace std;

void joe(SafeIntArr fred)
{
        fred.store(2,8888);
        fred.store(15,-8888);
        cout << "Z: " << fred << endl;
}

main()
{
        SafeIntArr arr(20);

        for(int i = 0; i < 20; ++i) arr.store(i, i+1);

        SafeIntArr arr2(10);
        arr2 = arr;

        arr2.store(3,999);
        arr2.store(17,-999);

        cout << "A: " << arr << endl;
        cout << "B: " << arr2 << endl;

        joe(arr);

        cout << "C: " << arr << endl;
        cout << "D: " << arr2 << endl;
}