home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OpenStep 4.2J (Developer)
/
os42jdev.iso
/
NextDeveloper
/
Examples
/
Foundation
/
TCPTransport
/
RemoteTest.m
< prev
next >
Wrap
Text File
|
1996-04-17
|
1KB
|
49 lines
/* RemoteTest.m created by blaine on Tue 16-Apr-1996 */
#import "RemoteTest.h"
@implementation RemoteTest
- init {
[super init];
myHost = [[NSHost currentHost] retain];
otherObject = nil;
return self;
}
- (void)dealloc {
[myHost release];
[super dealloc];
}
- (NSHost *)host {
return myHost;
}
- (NSDate *)date {
return [NSDate date];
}
- (void)log:(NSString *)message {
NSLog(@"%@", message);
}
- (void)setOtherObject:(NSObject *)anObject {
[anObject retain]; // in case it == otherObject & there is only 1 ref
[otherObject release];
otherObject = anObject;
}
- (NSObject *)otherObject {
return [[otherObject retain] autorelease];
// most expensive but safest way to hand out an attribute
// Alternatives are: return otherObject, but if later someone
// does a setOtherObject the caller will be left with garbage
// Another alternative is to return otherObject here but do
// a [otherObject autorelease] in the setOtherObject: method.
// This works most of the time... but... fails if a setOtherObject:
// occurs after a new autorelease pool is formed then reclaimed, again
// leaving the caller holding garbage.
}
@end