Created
July 13, 2011 17:31
-
-
Save cruffenach/1080815 to your computer and use it in GitHub Desktop.
BlogPost with Synthesized Properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@class Author; | |
@interface BlogPost : NSObject { | |
NSString *_postName; | |
NSDate *_postDate; | |
Author *_author; | |
} | |
@property (nonatomic, retain) NSString *postName; | |
@property (nonatomic, retain) NSDate *postDate; | |
@property (nonatomic, retain) Author *author; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "BlogPost.h" | |
#import "Author.h" | |
@implementation BlogPost | |
@synthesize postName = _postName; | |
@synthesize postDate = _postDate; | |
@synthesize author = _author; | |
-(id)init { | |
if(self = [super init]) { | |
self.postName = @""; | |
self.postDate = [NSDate date]; | |
self.author = nil; | |
} | |
return self; | |
} | |
-(void)dealloc { | |
[_postName release]; | |
[_postDate release]; | |
[_author release]; | |
[super dealloc]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment