Root class of the Cocoa/GNUStep Foundation Kit. If you're writing Objective C, every class you declare will inherit from NSObject. There are a few special classes which do not inherit NSObject, but there's a good chance you'll never use one of them. Provides the essential object methods such as:

+ (id)alloc(void)
Class method - allocates space for the object and instance variables.
- (id)init(void)
Instance method - initializes instance variables (generally overriden by the author of a subclass to include class-specific initialization).
- (void)dealloc(void)
Instance method - releases object's allocated memory. Should always be overriden with class-specific deallocations, unless you want memory leaks. To declare an NSObject (or generally, any subclass of it), the simple nested statement that follows should be sufficient:
[[NSObject alloc ] init ];
Hopefully, you'll get around to releasing it:
[NSObject release ];

Log in or register to write something here or to contact authors.