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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to