10-4. Write a class that implements a list that holds strings.
10-5. Write a bidirectional iterator for your String_list class.
10-6. Test the class by rewriting the split function to put its output into a String_list.

there are theses three exercises in the book I'm studying, what is it asking me to do ? to create a 'container' ? and how should I approach this ? any hints?

6 Years
Discussion Span
Last Post by DinoG

I am convinced that the exercise is in the wrong place in the book. The list class should be written as a linked list. It seems to me that a bi-derectional iterator should be a class (perhaps a subclass of the list) but in order to work you have to override the ++ and -- operators, and the book doesn't teach that until a later chapter. There are two other alternatives: (1) write the iterator as a class that does NOT accept ++ and -- but instead has .increment() and .decrement() methods. Or (2) implement the list under the hood as an array of strings (maybe this is what they wanted) in which case the iterator could simply be a pointer and it would work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.