Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In Chapter 4, you will learn about properties. You should use them and their accessor methods. If you do, you avoid this section’s complications. But you should still understand a little about instance variables and how they are handled in memory. Suppose you have an instance variable, personName, you wish to set, as in Listing 3-19.
#import <Foundation/Foundation.h>
@interface Simple : NSObject {
NSString * personName;
}
-(void) sayGoodBye;
-(void) sayName;
-(void) sayHello: (NSString *) name;
@end
|