Dennis R
10-09-2007, 06:00 AM
I am slowly working my way through the Java tutorial, I've only got as far as object oriented concepts and I already have a question.
It states that " By attributing state (current speed, current pedal cadence, and current gear) and providing methods for changing that state, the object remains in control of how the outside world is allowed to use it. For example, if the bicycle only has 6 gears, a method to change gears could reject any value that is less than 1 or greater than 6. "
What isn't clear though is where I get to state that the bicycle only has 6 gears. It don't think it's the state as that just says what gear it is now?
Am I missing something or jumping ahead?
Thanks for your help
It states that " By attributing state (current speed, current pedal cadence, and current gear) and providing methods for changing that state, the object remains in control of how the outside world is allowed to use it. For example, if the bicycle only has 6 gears, a method to change gears could reject any value that is less than 1 or greater than 6. "
What isn't clear though is where I get to state that the bicycle only has 6 gears. It don't think it's the state as that just says what gear it is now?
Am I missing something or jumping ahead?
Thanks for your help