oc 类型判断

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

@interface A : NSObject

@end

@implementation A


@end


@interface AA : A

@end

@implementation AA


@end

@interface B : NSObject

@end

@implementation B


@end


int main(int argc, char * argv[]) {
    A *a=[[A alloc]init];
    NSLog(@"%d",[a isKindOfClass:[B class ] ]);//返回值1表示是这个类型,0不是这个类型
}

 

posted @ 2015-08-19 14:22  netcorner  阅读(741)  评论(0编辑  收藏  举报