Explain the concept of 'Dynamic Dispatch' or 'Late Binding'.
Last updated
Dynamic dispatch (late binding) chooses the method implementation at runtime from the object's actual type, not the reference's declared type. It powers overriding and polymorphism.
Typically implemented with a vtable (virtual method table): each object points to its class's table, and calls look up the function pointer at runtime.
Java/Python methods are virtual by default, while C++ needs
virtual. The indirect lookup is slightly slower and harder to inline.
- https://www.reddit.com/r/developersIndia/comments/1ktgmfk/software_development_interview_preparation/
- https://www.reddit.com/r/programming/comments/1m2ff3j/casey_muratori_the_big_oops_anatomy_of_a/
- https://www.reddit.com/r/SoftwareEngineering/comments/1ijqgpb/is_the_o_in_solid_still_relevant_or_just_a_relic/
- https://www.reddit.com/r/NorthropGrumman/comments/1bt1ug3/monthly_employmentcorporate_questions_and/