This has continued to confuse me and I’ve gone through the book several times.
In the beginning of chapter 20, the example is given regarding creating a property that points to an object:
@property (nonatomic) NSDate *hireDate;
Then it says: “recognize that you have declared a property named hireDate that is a pointer to an NSDate.” That is clear.
From there: “…by default you get an instance variable. This variable is named _hireDate and is a pointer to an NSDate. The compiler also synthesizes two accessor methods:”
- (void)setHireDate:(NSDate *)d; - (NSDate *)hireDate;
I understand why these methods are created, what is confusing is the syntax - namely the (NSDate *) part. What does the pointer point to within the parentheses? When should I use that syntax? Can someone describe it in more human language terms?
While these methods are synthesized behind the scenes, there are other examples later in the book where we must explicitly use this syntax and it is barely glossed over with no explanation. Any help would be appreciated.