Operator overloading

Your task is to add some operator overloading to the List class David presented last Friday, testing as you go.
  1. To obtain directory containing the starting point for this lab (essentially the List class David described), type
        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.

  2. First add the following member function:
        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.

  3. Add the following 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. Tyoe
        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.