Re: Hillegas printing Stuck again!!
Re: Hillegas printing Stuck again!!
- Subject: Re: Hillegas printing Stuck again!!
- From: Antonio Nunes <email@hidden>
- Date: Wed, 29 Aug 2007 10:18:21 +0100
On 29 Aug 2007, at 10:03, Martin Kyte wrote:
Person *p = [people objectAtIndex:i];
and then try to access each part of the object
[p personName] I get selector not recognised error
-[NSCFDictionary expectedRaise]: selector not recognized [self =
0x322b40]
I cannot understand why p should be of NSCFDictionary type and not
my class type Person.
Regardless of how you declare p, it will be the type of the object
assigned to it at runtime. So it would seem you filled your people
array with dictionaries rather than with persons. Assigning "Person
*p" is good for a lot of things, but at runtime this is not that
important (I think), and you might as wel have assigned "id p". Think
of it this way: p will point to whatever object is assigned to it,
and the runtime knows the type of the object. How it is declared at
compile time is of lesser consequence at runtime. (If this is
incorrect or not that good a way of putting it I'm sure someone will
chip in.)
-António
-----------------------------------------------------------
And could you keep your heart in wonder
at the daily miracles of your life,
your pain would not seem less wondrous
than your joy.
--Kahlil Gibran
-----------------------------------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden