Dynamic Dispatch
noun
say it: “dy-NAM-ik dih-SPACH” /daɪˈnæmɪk dɪˈspætʃ/
Choosing which version of a method to run from the object's real type, while the program runs.
What is Dynamic Dispatch?
Dynamic dispatch is how polymorphism works under the hood: when a method is called, the program decides while running which version to use, based on the object's real type.
Animal pet = new Dog();
pet.Speak(); // runs Dog.Speak(), not Animal.Speak()
In a sentence
- “Dynamic dispatch runs Ebook's Describe() even through a Book variable.”
Level: Journeyman · More OOP terms at this level
Updated