3 ms·
Contrast that to Objective C < 2, Ruby, or Smalltalk where everything is a message sent to the object and there are no exposed, public fields.
by jonhohle 8y ago
Contrast that to Objective C < 2, Ruby, or Smalltalk where everything is a message sent to the object and there are no exposed, public fields.
- wool_gather 8y agoYou're misremembering. Prior to ObjC 2, classes indeed exposed fields. Convention was that you should not touch them and use accessors instead, but they were most definitely there, declared in the `@interface`. @interface Foo : NSObject { NSString * name; NSInteger count; } - (NSString)name; - (void)setName:(NSString *)newName; - (NSInteger)count; @end (This is still legal, of course, but bad practice now that there's `@property` synthesis as well as ivars being declarable in either an extension or the `@implementation` block.)