- 可以将.m文件通过命令行 转化为cpp文件后查看源码
Clang编译示例-方法调用实质runtime
objc_msgSend(<#id self#>, <#SEL op, ...#>)
// receiver super_class
// objc_msgSendSuper(<#struct objc_super *super#>, <#SEL op, ...#>)
/*
receiver -> self
objc_msgSendSuper({self, class_getSuperclass(objc_getClass("Person"))}, sel_registerName("description"));
*/
/*
// ():强转类型,是编译通过.
Person *p = objc_msgSend(objc_getClass("Person"), sel_registerName("alloc"));
p = objc_msgSend(p, sel_registerName("init"));
objc_msgSend(p, sel_registerName("eat"));
*/
Person *p = [Person alloc];
// Person *p = objc_msgSend(objc_getClass("Person"), sel_registerName("alloc"));
p = [p init];
// p = objc_msgSend(p, sel_registerName("init"));
[p run:2];
// objc_msgSend(p, sel_registerName("run:"), 2);
// objc_msgSend(p, sel_registerName("eat"));