Listclass David presented last Friday, testing as you go.
Listclass David described), type
cp -r ~mc38/labs/operator-overloading/files list-stuffAfter 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
getNthin 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.ccin order to test that it works properly.
ostream& operator<<(ostream&, const List&);Note that you will need to make it a friend of both
List. Add the appropriate code to
testList.ccin 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. Tyoe
cp -r ~mc38/labs/operator-overloading/files/rational rationalto copy the files. Check-off: When you have written and tested these procedures, ask one of us to check you off.