Dynamic binding
Associating a method call to the code to be executed is called binding. As opposed to static binding, where the code associated with the method call is bound during the compile time, dynamic binding means that the code associated with a given method call is not known and will be determined during runtime.
Dynamic binding is associated with polymorphism and inheritance because a method call associated with a polymorphic reference may depend on the dynamic type of that reference.
For instance, our view's static type is UIView, and its dynamic type may be UILabel, UITextField, or UIButton. Let's suppose that some of the methods in UIView are overridden for UIButton. When we call those methods, runtime will dynamically bind the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access