home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula
/
nebula.bin
/
SourceCode
/
MiniExamples
/
CellScrollView
/
FooObject.m
< prev
next >
Wrap
Text File
|
1991-10-10
|
768b
|
41 lines
/*
* 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