List
class, testing as you go.
cp -r ~mc38/labs/operator-overloading/files list-stuff
After making and running the program, read through the files to the
point that you understand what is going on.
ListItem& operator[](int n);
Note, in particular, that this operator differs from the member
function getNth in that it returns a reference to
the value, not just the value itself. It should also differ by
returning the (n+1)st value; just like arrays, you should begin the
indexing at 0. Add the appropriate code to testList.cc
in order to test that it works properly.
friend function:
ostream& operator<<(ostream&, const List&);
Note that you will need to make it a friend of both Node
and List. Add the appropriate code to
testList.cc in order to test that it works properly.
For an example of the syntax and appropriate files for operator
overloading, you may refer to the testRational discussed in
class. Type
cp -r ~mc38/labs/operator-overloading/files/rational rational
to copy the files.
Check-off: When you have written and tested these procedures,
ask one of us to check you off.