Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 3. Just Enough Objective-C: Part One > Instance Variables and Memory

Instance Variables and Memory

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.

Listing 3-19. An instance variable in Simple.h

#import <Foundation/Foundation.h>
@interface Simple : NSObject {
  NSString * personName;
}
-(void) sayGoodBye;
-(void) sayName;
-(void) sayHello: (NSString *) name;
@end


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial