I have a quick question. On page 103 the book states that in object oriented programming we try our best to keep the instance variables private. We do not want the user to be accessing them directly. Hence we use methods (which i think of as functions inside the object). That makes sense since we do not have direct contact with the variables. But why?
Also when we use @property/synthesize method of writing, are we not using the variable names to access the setter and getter methods? Like in the example, our instance variables are called heightInMeters and weightInKilos. Using the synthesize “feature” i no longer have the option to have my own function name which returns heightInMeters. Instead, i have to know what the variable is like heightInMeters and then when i call it, the compiler creates a function which returns the variable value. I dont know if i explained it properly but i dont see the point in that case since the variable is not “masked” by the function anymore.
Your help is greatly appreciated