I can understand defining the functions in the @interface of the header file, but why the instance variables? Shouldn’t the instance variables be private, only accessible through messages?
I can understand defining the functions in the @interface of the header file, but
Share
The reason is so it can calculate offsets of variables for subclasses.
Without knowing the structure of the “Bird” class, the “Penguin” class can’t calculate the offset of its fields from the beginning of the structure. The penguin structure looks kind of like this:
This has a side effect: if you change the size of a class in a library, you break all the subclasses in apps that link to that library. The new properties work around this problem.