A new class is declared with the @interface directive. The interface file for its superclass must be imported:
#import "ItsSuperclass.h" |
@interface ClassName : ItsSuperclass < protocol_list > |
{ |
instance variable declarations |
} |
method declarations |
@end |
Everything but the compiler directives and class name is optional. If the colon and superclass name are omitted, the class is declared to be a new root class. If any protocols are listed, the header files where they’re declared must also be imported.
A file containing a class definition imports its own interface:
#import "ClassName.h" |
@implementation ClassName |
method definitions |
@end |
Last updated: 2008-02-05