Your task is to add some operator overloading to the List class, testing as you go.
To get started, you should first download the file
List.zipto convenient location and import it into Eclipse. After making and running the program, read through the files to the point that you understand what is going on. It is not exactly the implementation we wrote in class yesterday, but it is very similar. For your convenience, I am also providing you the file
OverloadedPoint3D.zip, which is the example I did on class on Tuesday. If you import this file into Eclipse, you can use it to guide your tasks below.
First add the following member function:
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)th 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.
Add the following
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. In particular, I want it to do the exact same thing as
List::display()does, except that it should not add a newline. Thus, if
Listvariable, then the following call should be equivalent to
cout << list << endl;
Check-off (2 points): When you have written and tested these procedures, ask me to check you off.