brintos

brintos / llvm-project-archived public Read only

0
0
Text · 770 B · df88eea Raw
45 lines · plain
1#import <Foundation/Foundation.h>2 3@interface MyClass : NSObject {4  int member;5}6 7- (id)initWithMember:(int)_member;8- (NSString*)description;9@end10 11@implementation MyClass12 13- (id)initWithMember:(int)_member14{15    if (self = [super init])16    {17      member = _member;18    }19    return self;20}21 22- (void)dealloc23{24    [super dealloc];25}26 27// Set a breakpoint on '-[MyClass description]' and test expressions: expr member28- (NSString *)description29{30    return [NSString stringWithFormat:@"%d", member];31}32@end33 34int main (int argc, char const *argv[])35{36    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];37 38    MyClass *my_object = [[MyClass alloc] initWithMember:5];39 40    NSLog(@"MyObject %@", [my_object description]);41 42    [pool release];43    return 0;44}45