@class是放在interface中的,只是为了在interface中引用这个类,把这个类作为一个类型来用的。 在实现这个接口的实现类中,如果需要引用这个类的实体变量或者方法之类的,还是需要import在@class中声明的类进来.
a.h
@class Rectangle;
@interface A : NSObject {
…
}
a.m
#import Rectangle
@implementation A
@class是放在interface中的,只是为了在interface中引用这个类,把这个类作为一个类型来用的。 在实现这个接口的实现类中,如果需要引用这个类的实体变量或者方法之类的,还是需要import在@class中声明的类进来.
a.h
@class Rectangle;
@interface A : NSObject {
…
}
a.m
#import Rectangle
@implementation A