Properties will almost never be of a mutable type. If they do, then the caller can get a pointer and change the properties of the object behind him. If a property needs to be changed externally, it must be through mutation methods.
Remember that properties define an interface, not an implementation. @synthesize can create an implementation from a property declaration, but if that is not right you should not use it.
So, the first step is to define an interface for your class and subclass without regard to implementation. Only after you know what interfaces should be, you should design implementation of each of them.
Regardless of whether the external property is changed, the database instance variable can be volatile. For this class, you may need to completely modify your own property.
You can force the base class to have a designated initializer that takes an array object as a parameter (of type id , so you do not need to override the subclass to handle it as NSMutableArray* ). The initializers of the normal class then called this designated initializer using NSArray . The initializer assigned by the subclass is called by the initializer of the assigned superclass, passing it to NSMutableArray .
Alternatively, the base class initializer could call another method to get the array. The base class implementation will return NSArray . A subclass can override this method to return an NSMutableArray .
Ken thomases
source share