Iterators
The goal of this lab is to give you a bit more experience with iterators. Complete the steps below:
- Create a new Project and add the following pieces of code to the project: student.h - student.cpp - iterator.cpp.
- Review and understand the MyVector class, the Iterator class, and the VectorIterator class (all in iterator.cpp).
- Complete the code fragment described in the comment at the bottom of the main function in iterator.cpp.
Email me (srollins@mtholyoke.edu) the following by Friday, 3/17/06 - 5pm.
- Attach your completed iterator.cpp.
- Explain what happens in the following line of code: itr->next()->print();. Be as specific as possible.
- How would you implement an Iterator class that had an array, instead of a MyVector, as its owner? You should provide a high-level discussion, an implementation is not necessary.
Sami Rollins