Safe Array Driver 1
#include <iostream> #include "gsafearr.h" using namespace std; void joe(SafeArr<int> fred) { fred.store(2,8888); fred.store(15,-8888); cout << "Z: " << fred << endl; } int main() { SafeArr<int> arr(20); for(int i = 0; i < 20; ++i) arr.store(i, i+1); SafeArr<int> 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; }