Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Classes

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


< Previous PageNext Page > Hide TOC


Last updated: 2008-02-05




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice