self

Inside any method, you have access to the implicit local variable self. self is a pointer to the object that is running the method. It is used when an object wants to send a message to itself.

For example, many Objective-C programmers are quite religious about never reading or writing to an instance variable directly. They even call accessors within implementations of other methods in the same class.

Currently, your implementation of bodyMassIndex accesses the instance variables directly. In BNRPerson.m, update bodyMassIndex to use the accessor methods instead:

-​ ​(​f​l​o​a​t​)​b​o​d​y​M​a​s​s​I​n​d​e​x​
{​
 ​ ​ ​ ​r​e​t​u​r​n​ ​_​w​e​i​g​h​t​I​n​K​i​l​o​s​ ​/​ ​(​_​h​e​i​g​h​t​I​n​M​e​t​e​r​s​ ​*​ ​_​h​e​i​g​h​t​I​n​M​e​t​e​r​s​)​; ...

Get Objective-C Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.