Homework 4
Physics 231C: Simulations in C++
Spring 1999
Problem Set 4
Due 2:00 pm Tuesday, May 4.
1. Write an class Array2D along the lines of the Array class from
class, but for 2D arrays. Rather than try to use mat[i][j],
use operator() to allow mat(i,j). Write and run a main program to
test all the class's public functions.
2. Make Array2D into a class template. Test it for both
Array2D < int> and Array2 < double>.
In all cases, show what happens when you compile and run your program.