ANONYMOUS wrote:
Are we allowed to modify the provided RangeIterator class? (for example, to add another method)
I would advise not to.
Technically the instructions and marking rubric do not forbid it, but there is no good reason to do so. You may lose marks like the style mark for elegant and logical code.
What is your motivation for adding a method?
If you believe modifying RangeIterator
is the more elegant solution, then you may, but I will leave you with the following to consider:
Think about the OOP design principles. RangeIterator
already implements everything required by DoubleEndedIterator
. Does the method you are adding introduce additional responsibilities into RangeIterator
? Does it make sense for these responsibilities to be a part of every RangeIterator
object?