This is FooObject.m in view mode; [Download] [Up]
/* * You may freely copy, distribute, and reuse the code in this example. * NeXT disclaims any warranty of any kind, expressed or implied, as to its * fitness for any particular use. */ #import "FooObject.h" #import <objc/hashtable.h> #import <libc.h> @implementation FooObject static int memory = 0; - init { char buf[100]; [super init]; /* Note that this counter does not get reset even if all foo objects * are freed. */ intValue = memory++; sprintf(buf,"object %x",intValue); stringValue = NXCopyStringBuffer(buf); return self; } - free { /* Make sure the string buffer allocated gets freed */ free(stringValue); return [super free]; } - (int)intValue { return intValue; } - (char *)stringValue { return stringValue; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.