You can override a readonly property to make it writable. For example, you could define a class MyInteger with a readonly property, value:
@interface MyInteger : NSObject |
{ |
NSInteger value; |
} |
@property(readonly) NSInteger value; |
@end |
@implementation MyInteger |
@synthesize value; |
@end |
You could then implement a subclass, MyMutableInteger, which redefines the property to make it writable:
@interface MyMutableInteger : MyInteger |
@property(readwrite) NSInteger value; |
@end |
@implementation MyMutableInteger |
@dynamic value; |
- (void)setValue:(NSInteger)newX { |
value = newX; |
} |
@end |
Last updated: 2008-07-08