description and %@
In calls to NSLog(), you have been using the token %@ to get an object to describe itself.
The %@ token sends a description message to the object pointed to by the corresponding variable.
The description method returns a string that is a useful description of an instance of the class. It is an NSObject method, so every object implements it. The default NSObject implementation returns the object’s address in memory as a string.
However, a memory address is often not the most useful way to describe an instance. A class can override description:. For example, NSDate overrides description to return the date/time that the instance holds. NSString overrides description to return the string itself.
In BNREmployee.m ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access