Hi All
While working through chapter 21 - I was struck by the 'description' implementation on page 157 ...
-
(NSString *)description
{
return [NSString stringWithFormat:@"<Employee %d: $%d in assets>", self.employeeID, self.valueOfAssets];
}Specifically the code ‘self.valueOfAssets’.
I did a 'double take' and thought to myself - "Hmmm - I don't remember creating a @property for valueOfAssets'. This can't be right - 'valueOfAssets' is an instance method and as such in needs to be sent as a message to self ...
[self valueOfAssets].
I double (and triple) checked that valueOfAssets was not a property - but the code still worked. I even created a dummy Foo object to recreate accessing a method with no arguments using dot notation - and it WORKED.
I googled around a bit and discovered that it is possible to use dot notation to send a message that takes no arguments (like 'valueOfAssets' above) - but why would you ? Its confusing. Interested in the opinion of others.
Thanks
Dave