three20 - Need to cast in Objective C to use dot notation? -
this in context of using three20 relates more i'm not getting aout objective c. i'm in tttablelinkeditemcell
, trying assign property called readat
.
//_item.readat = [[nsdate alloc] init];
"request member 'readat' in not structure or union"
[_item setreadat: [[nsdate alloc] init]];
works expected. then...
((notificationitem *)_item).readat = [[nsdate alloc] init];
also works. seems need cast use dot notation, obj-c happily pass along messages blindly? correct rule i'm taking away this?
ps: _item
, per three20 api, is: tttablelinkeditem * _item
.
the compiler needs know object's type in order use dot notation access property — casting necessary if object wasn't statically typed begin with. message sends valid object, long variable has object type, work.
so why need know static type property accessor? because property can designate method getter or setter, not default pair of foo
, setfoo:
, compiler needs know property in order generate correct accessor calls.
Comments
Post a Comment