Re: Class Extensions (Re: Clueless about this warning)
Re: Class Extensions (Re: Clueless about this warning)
- Subject: Re: Class Extensions (Re: Clueless about this warning)
- From: Bill Bumgarner <email@hidden>
- Date: Sat, 04 Oct 2008 13:43:22 -0700
On Oct 4, 2008, at 12:43 PM, Andrew Merenbach wrote:
On Oct 4, 2008, at 10:32 AM, Bill Bumgarner wrote:
Class extensions are also the one place where you can redeclare
that a property is readwrite.
Hi! Â Bill makes a very well-written explanation, but I beg to
append (in a very nit-picky fashion) to this point, if only for the
sake of the archives. Â If one visits <http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html
>, one sees (under "Property Re-declaration") that:
If you declare a property in one class as readonly, you can
redeclare it as readwrite in a class extension (see
âExtensionsâ), a protocol, or a subclass
Correct. Protocols and subclasses enable different behaviors from
extensions.
Specifically -- a protocol effectively indicates that your class will
implement some set of required or optional methods with the additional
benefit of adding a bit of compile time and runtime accessible
metadata to the class that says that it conforms to that protocol.
A subclass can override the readonly declaration of a property such
that you can create immutable superclass / mutable subclass type
relationships akin to various Foundation classes.
b.bum
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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