The mileage +=miles
Why can't change or
Thank you
CodePudding user response:
The parameters in the mileage is update_odometer function, scope only within the functionSelf. Odometer_reading +=miles this function in increment_odometer function, can't access the mileage in the function variables, so can't change
Self odometer_reading is equivalent to a bridge, as the class variables, can access in a function within the class