Re: const correctness
Re: const correctness
- Subject: Re: const correctness
- From: Nick Zitzmann <email@hidden>
- Date: Mon, 19 Mar 2012 09:43:17 -0600
On Mar 19, 2012, at 5:51 AM, Ian Joyner wrote:
> Actually NSArray. Note NSMutableArray inherits from NSArray because it adds extra functionality in methods that can change the object. You can assign an NSMutableArray object to an NSArray reference, thereby making it unchangeable via that path, but you can't assign an NSArray object to an NSMutableArray.
Declaring an NSMutableArray as an NSArray doesn't make it immutable, because you can still send NSMutableArray messages to the array and they'll still work (though the compiler will complain unless you mask them or send the message indirectly). The only way to make a mutable array immutable is to make an immutable copy of the array.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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