multiple cache entries and it often only takes a couple of instructions to get execution to the correct method on an initial cache miss. The common case will be a cached class match, and execution will just continue in the method. Out-of-line caching can also be used in the method invocation logic, using the object class and method selector. In one design, the class and method selector are hashed, and used as an index into a method dispatch cache table. As Smalltalk is a reflective language, many implementations allow mutating individual objects into objects with dynamically generated method lookup tables. This allows altering object behavior on a per object basis. A whole category of languages known as prototype-based languages has grown from this, the most famous of which are Self and JavaScript. Careful design of the method dispatch caching allows even prototype-based languages to have high-performance method dispatch. Many other dynamically typed languages, including Python, Ruby, Objective-C and Groovy use similar approaches. Example in Python class Cat: def speak(self): print("Meow") class Dog: def speak(self): print("Woof") def speak(pet): # Dynamically dispatches the speak method # pet can either be an instance of Cat or Dog pet.speak() cat = Cat() speak(cat) dog = Dog() speak(dog) Example in C++ #include <iostream> // make Pet an abstract virtual base class class Pet { public: virtual void speak() = 0; }; class Dog : public Pet { public: void speak() override { std::cout << "Woof!\n"; } }; class Cat : public Pet { public: void speak() override { std::cout << "Meow!\n"; } }; // speak() will be able to accept anything deriving from Pet void speak(Pet& pet) { pet.speak(); } int main() { Dog fido; Cat simba; speak(fido); speak(simba); return 0; } See also Function multi-versioning Function overloading Message passing Method overriding Double dispatch Name binding References Further reading (NB. Something similar to "fat pointers" specifically for Intel's real-mode segment:offset addressing on x86 processors, containing both a deliberately denormalized pointer to a shared code entry point and some info to still distinguish the different callers in the shared code. While, in an open system, pointer-normalizing 3rd-party instances (in other drivers or applications) cannot be ruled out completely on public interfaces, the scheme can be used safely on internal interfaces to avoid redundant entry code sequences.) [https://web.archive.org/web/20220711181007/https://www.drdobbs.com/architecture-and-design/cs-biggest-mistake/228701625] Polymorphism (computer science) Method (computer programming)