-
Notifications
You must be signed in to change notification settings - Fork 0
/
props.m
47 lines (33 loc) · 798 Bytes
/
props.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#import <Foundation/Foundation.h>
// ----------------------------------------------------------------------------
@interface WProps : NSObject {
NSString *message;
}
@property(copy) NSString *message;
-(WProps*) msg:(NSString*) ms;
-(void) show;
@end
@implementation WProps
@synthesize message;
-(WProps*) msg:(NSString*) ms {
self = [super init];
if (self) {
[self setMessage:ms];
}
return self;
}
-(void) show {
NSLog(@"%@", message);
}
@end
// ----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
WProps *props = [[WProps alloc] msg:@"Message"];
[props show];
NSLog(@"%@", props.message);
[props release];
[pool drain];
return 0;
}