Own declaration. Essentially, it tells the compiler that theres a class of that name. I use it in interface declarations:
@class Foo; @interface Bar : NSObject { Foo *someFoo; } @end
Of course, you can import the header instead of Foo :
#import "Foo.h" @interface Bar : NSObject { Foo *someFoo; } @end
But if someFoo not provided to Bar users, they will import an additional header file that they do not need. When declaring @class , Bar users do not see additional import because Foo.h will be imported into the Bar implementation file.
zoul Oct 11 '10 at 8:48 2010-10-11 08:48
source share