• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Accessing properties of a generic class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessing properties of a generic class


  • Subject: Accessing properties of a generic class
  • From: John Murphy <email@hidden>
  • Date: Wed, 20 Aug 2008 19:54:09 -0700 (PDT)

I have a Person class with name and image properties stored in an array. When I access its properties from within the controller class like this:

	Person *person = [objectArray objectAtIndex:0];
	[nameField setStringValue:person.name];
	[imageArea setImage:person.image];

everything works fine. But when I try to do it generically:

	id object = [objectArray objectAtIndex:0];
	[nameField setStringValue:object.name];
	[imageArea setImage:object.image];

I get errors about the name and image properties not being in a structure or union.




_______________________________________________

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

  • Follow-Ups:
    • Re: Accessing properties of a generic class
      • From: Chris Hanson <email@hidden>
  • Prev by Date: Re: MacBook Wake On Lan
  • Next by Date: Re: !foo vs foo == nil
  • Previous by thread: DEV Wanted - iTunes plugin
  • Next by thread: Re: Accessing properties of a generic class
  • Index(es):
    • Date
    • Thread