Question text in black, answers in blue.
addToLead
and removeLead
doesn't update
the size
field. Is that a mistake?
Yes, it is. I've now fixed it, and you get a point.
Would it be a good idea to make the setSize
method private, or
leave it out entirely, so that the user can't reset the size
field without adding or removing a dog?
That's a reasonable idea but I don't think it's necessary -- we will hope that the user only resets the size when they know what they are doing. I can think of reasons to do it -- what if you spliced together two DogTeam
objects by making the rear of one point to the front of the other -- you would want to update the size, but you aren't using any methods to add or remove dogs.
Last modified 8 November 2011