isMemberOfClass和isKindOfClass

实例方法对应的A为
类方法对应的A为元类

  1. //isMemberOfClass 直接判断
  2. //isKindOfClass 调用者可循环 ([a class]->superclass == A)
  3. [a isMemberOfClass:A ];
  4. [a isKindOfClass:A];
  5. Man *man = [Man new];
  6. BOOL a = [man isMemberOfClass:[Man class]]; //1
  7. BOOL b = [man isKindOfClass:[Man class]]; //1
  8. BOOL c = [Man isKindOfClass:[NSObject class]]; //1
  9. BOOL d = [Man isMemberOfClass:[NSObject class]]; //0