Copyright ©1995 by NeXT Computer, Inc. All Rights Reserved.
|The NXReference protocol defines a set of methods for implementing simple reference counting of objects. This allows an object to be referenced multiple times without each client needing to assume that the referenced object may be in use by others. A client of the referenced object can simply send it a free message when finished; if the object still has outstanding references, it doesn't free itself.|
|Adding or deleting a reference||addReference|
|Getting the number of references|
|Increments the number of references to the receiver and returns self.|
|Decrements the receiver's reference count, returning self if the reference count remains greater than 0. If the reference count becomes 0, this method deallocates the receiver's storage and returns nil.
A typical implementation for a reference counted object that is vended over a Distributed Objects connection might look like this:
if (refs > 0) return self;
return [super free];
|Returns the number of references to the receiver.|