Apple Interview Question
Software Engineer / DevelopersCountry: United States
Dynamic binding is determining the method to invoke at runtime instead of at compile time. Dynamic binding is also referred to as late binding. In Objective-C
code executed is determined by both the method name (the selector) and the receiving object.
[myObject myMethodWithArg:a andArg:b ];
like
objc_msgSend(myObject, "myMethodWithArg:andArg:", a, b);
Dynamic binding moves the message-method connection to runtime, as opposed to compile time (see v_table in C). Languages having this feature (e.g. Objective-C) permit the sending of a message to an object that may not respond. While it brings flexibility on development, often causes crashes in runtime. At best you see "warning: 'MyClass' may not respond to -foo" in the compiler output.
- Ozan Eren Bilgen October 19, 2012