Dynamic Dispatch

Choosing which version of a method to run based on the object's real type, at run time.

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()

Level: Journeyman · More OOP terms at this level

Updated

In other subjects