2019独角兽企业重金招聘Python工程师标准>>>
Effective Objective-C - Familiarize Yourself with Objective-C's Roots
把Objective-C 和 C++ 两门面向对象编程语言进行对比。它们语法出现差异的原因,是触发对象行为的方式不同,Objective-C 是向对象传递消息的结构模式(Objective-C 演变自 Smalltalk, Smalltalk 使用了传递消息的机制),而 C++ 是函数调用。代码举例:
// Messaging (OBJC)Object *obj = [Object new];[obj performWith:parameter1 and:parameter2];// Function calling (C++)Object *obj = new Object;obj -> perform(parameter1, parameter2);
Objective-C 的动态绑定特性,在 运行时(runtime)进行对象方法的匹配,而不是在编译的时候。
在 运行时 阶段,一组代码会和你的代码进行合并起来,并且把你的代码和动态库相连接。
Objective-C 中对象在内存中的存储方式。
NSString *someString = @"The string";NSString *anotherString = someString;
Jun 24, 2015