I’m still a little bit puzzled by this same part in the chapter by the way.
The way the book reads, it’s saying that an object that is an instance of the class BNREmployee can in fact still access the officeAlarmCode method. In this particular example mikey is literally a pointer to an instance of BNREmployee and, how I understand it, should have access to this particular method.
On the other hand, if I assume that anything that tries to access the method officeAlarmCode outside of the implementation file, wether it be an instance of BNREmployee or not will fail, it makes more sense.
Or is the fact that mikey is a pointer and not an actual instance of the object the fact it’s not working? If so, is there a way to access this method in main.m after all?
Little bit confused by this little snippet.
Edit: I just realised how this actually works and think the book leaves out an important bit of information for this part in the chapter to really make sense. What effectively happens by moving the ivar officeAlarmCode to a class extension is that it becomes impossible to set or get the ivar. I believe what needs to be added additionally after adding it to the class extension, are new methods to set, get and/or remove values to the ivar.