03.对象本质探究与isa
一、结构分析
@interface RKObject : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) int age;
@end
@implementation RKObject
@end
int main(int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
NSLog(@"Hello, World!");
}
return 0;
}1.1 还原成C++
1.2 一些关键内容
a. 定义
b. 结构体
c. 函数
d. isa
e. Class
f. id类型
二、isa
2.1 源码
2.2 isa的本质 isa_t
2.3 ISA_BITFIELD isa的位域
2.4 获取class对象: getClass
a.验证

b. 不使用掩码,通过位运算计算出Class
三、isa和类对象的绑定
3.1 class绑定流程图

3.2 中间有个判断 Nonpointer isa
四、Nonpointer isa
4.1 isa_t
4.2 isa_t::setClass
4.3 Nonpointer isa 和 纯isa的区别
Last updated