• 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
Re: clarification regarding properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: clarification regarding properties


  • Subject: Re: clarification regarding properties
  • From: Sherm Pendley <email@hidden>
  • Date: Fri, 27 Mar 2009 14:53:03 -0400

On Fri, Mar 27, 2009 at 2:31 PM, WT <email@hidden> wrote:

>
> On Mar 27, 2009, at 6:34 PM, Quincey Morris wrote:
>
>  The 'foo' in 'self.foo' is a property. The 'foo' in 'just foo' is *not* a
>> property, but an instance variable. It's really important to know that the
>> two are entirely different things, even when they are named the same.
>> Whether the property foo even uses an instance variable foo is an
>> implementation detail of your class. A property *may* be implemented using
>> an instance variable for its storage requirements, and the instance variable
>> *may* have the same name as the property, but neither of those things are
>> requirements.
>>
>
> I have trouble understanding the above. How can a property be implemented,
> if not by using an instance variable?


Any way you like. The property "foo" is nothing more than a pair of accessor
methods -foo and -setFoo:. Those methods can, and often do, manage an
instance variable of the same name, but that's not a requirement, just an
implementation detail. They could just as well use a differently-named
instance variable, or external storage such as a file or database. A
read-only property could even be calculated on demand, using no storage at
all.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________

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

References: 
 >clarification regarding properties (From: WT <email@hidden>)
 >Re: clarification regarding properties (From: Quincey Morris <email@hidden>)
 >Re: clarification regarding properties (From: WT <email@hidden>)

  • Prev by Date: Re: clarification regarding properties
  • Next by Date: Re: isEqual, isEqualToString, compare behaviors
  • Previous by thread: Re: clarification regarding properties
  • Next by thread: Re: clarification regarding properties
  • Index(es):
    • Date
    • Thread