Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.


1



Root Class




Class





Object


Inherits From: Object is the root class


The Foundation Kit also defines its own root class, NSObject. Foundation is a group of classes that provides the functionality of the Common classes (List, Hash, Storage, and so on) and other features to improve the object-oriented development process. For more information about NSObject and Foundation, see the Foundation Reference located on-line in /NextLibrary/Documentation/NextDev/Foundation. For information on using Object- and NSObject-based classes together, see HybridWorld in the Foundation Reference.



Initializing the Class

+ initialize Implemented by subclasses to initialize the class


Creating, Copying, and Freeing Instances

+ alloc Returns a new, uninitialized instance
+ allocFromZone:(NXZone *)zone Returns a new, uninitialized instance allocated from zone
+ new Returns a new, initialized instance
copy Returns an exact copy of the receiver
copyFromZone:(NXZone *)zone Returns an exact copy of the receiver allocated from zone
(NXZone *)zone Returns a pointer to the zone where the receiver resides
free Deallocates the memory occupied by the receiver
+ free Returns nil (you can't free a class)


Initializing a New Instance

init Initializes a new instance after it has been allocated


Identifying Classes

+ (const char *)name Returns the name of the class
+ class Returns the receiver, a class object
class Returns the class object for the receiver's class
+ superclass Returns the class object for the receiver's superclass
superclass Returns the class object for the receiver's superclass


Identifying and Comparing Instances

(BOOL)isEqual:anObject Returns whether the receiver and anObject are the same
(unsigned int)hash Returns an unsigned integer unique to the receiver
self Returns the receiver, an instance
(const char *)name Implemented by subclasses to return the receiver's name
(void)printForDebugger:(NXStream *)stream Writes information identifying the receiver to stream


Testing Inheritance Relationships

(BOOL)isKindOf:aClassObject Returns whether the receiver inherits from aClassObject
(BOOL)isKindOfClassNamed:(const char *)aClassName
Returns whether the receiver inherits from aClassName
(BOOL)isMemberOf:aClassObject Returns whether the receiver is an instance of aClassObject
(BOOL)isMemberOfClassNamed:(const char *)aClassName
Returns whether the receiver is an instance of aClassName


Testing Class Functionality

(BOOL)respondsTo:(SEL)aSelector Returns whether the receiver can respond to aSelector
+ (BOOL)instancesRespondTo:(SEL)aSelector Returns whether instances can respond to aSelector


Testing for Protocol Conformance

+ (BOOL)conformsTo:(Protocol *)aProtocol Returns whether the receiver conforms to aProtocol
(BOOL)conformsTo:(Protocol *)aProtocol Returns whether the receiver's class conforms to aProtocol


Sending Messages Determined at Run Time

perform:(SEL)aSelector Sends an aSelector message to the receiver
perform:(SEL)aSelector with:anObject Sends an aSelector message with one argument
perform:(SEL)aSelector Sends an aSelector message with two arguments
with:anObject
with:anotherObject


Forwarding Messages

forward:(SEL)aSelector :(marg_list)argFrame Implemented by subclasses to forward messages
performv:(SEL)aSelector :(marg_list)argFrame Sends an aSelector message with argFrame arguments


Obtaining Method Information

(IMP)methodFor:(SEL)aSelector Locates the receiver's implementation of aSelector
+ (IMP)instanceMethodFor:(SEL)aSelector Locates the implementation of aSelector
(struct objc_method_description *)descriptionForMethod:(SEL)aSelector
Returns information about the aSelector method
+ (struct objc_method_description *)descriptionForInstanceMethod:(SEL)aSelector
Returns information about the aSelector instance method


Posing

+ poseAs:aClassObject Substitutes the receiving class for aClassObject


Enforcing Intentions

notImplemented:(SEL)aSelector Indicates that aSelector isn't fully implemented
subclassResponsibility:(SEL)aSelector Generates an error if aSelector isn't implemented


Error Handling

doesNotRecognize:(SEL)aSelector Generates an unrecognized-selector error message
error:(const char *)aString, ... Generates a formatted error message using aString


Dynamic Loading

+ finishLoading:(struct mach_header *)header Implemented by a newly loaded class or category
+ startUnloading Implemented by a class or category about to be unloaded


Archiving

read:(NXTypedStream *)stream Implemented by subclasses to read receiver from stream
write:(NXTypedStream *)stream Implemented by subclasses to write the receiver to stream
startArchiving:(NXTypedStream *)stream Implemented by subclasses to prepare for archiving
awake Implemented by subclasses to reinitialize the receiver
finishUnarchiving Implemented by subclasses to replace the receiver
+ setVersion:(int)aVersion Sets the class version number to aVersion
+ (int)version Returns the version of the class definition