Dispatch Tables

The virtual method table technique works fine for statically typed languages, but will not work for dynamically typed languages since such a table would need to encode all methods, not simply those in the declared class.

An alternative technique also uses a table associated with each class., In this form, however, the table is a list of selector name/method pointer pairs. When a method is invoked, a run-time search is performed to compare the message being sent to the entries in this table. When the right method is found, it is executed.

In objective-C this function is known as objc_msgSend.

[audio] [real] Text to accompany slide10, in Chapter 21 of An Introduction to Object-Oriented Programming