Properties let you define instance variables and let the compiler take care of creating the accessor methods—that is, methods that access (get or set) variables or information. The compiler also generates the underscore version of the variable. Declaring a property is simple:
@property float fuelAmount;
This tells the compiler to create one instance variable and two methods:
float _fuelAmount; - (float)fuelAmount; - (void)setFuelAmount:(float)fuelAmount;
You might have noticed that the variable and method declarations are identical to the ones in Listing 2-3.
The compiler generates the underscore version of the variable for you. Any non-car objects have to use the getter and setter. The variables and method ...