子类同过isKindOfClass判断是否是父类的类型时,是会返回YES的
比如:
NSMutableArray *arr01 = [[NSMutableArray alloc] initWithCapacity:1];
if ([arr01 isKindOfClass:[NSArray class]]) {
NSLog(@"NSMutableArray is kind of class NSArray");
}
else {
NSLog(@"NSMutableArray is NOT kind of class NSArray");
}
能够打印:
NSMutableArray is kind of class NSArray