Explore BrainMass

Object-Oriented Programming

2) What is it's role in object-oriented programming?
3) What is the difference between functional and imperative programming language?
4) Why is LISP dominating the Artificial Intelligence?

© BrainMass Inc. brainmass.com July 22, 2018, 6:34 am ad1c9bdddf

Solution Preview

What is dynamic binding?
2) What is it's role in object-oriented programming?
Dynamic binding has two forms:
- Static and
- Dynamic.
Statically-typed dynamic binding is found in languages such as C++ (virtual functions) and Eiffel
(redefinition). It is not known which function will be called for a virtual function at run-time because a derived class may override the function, in which case the overriding function must be called. Statically determining all possibilities of usage is undecidable. When the complete program is compiled, all such functions are resolved (statically) for actual objects. Formal object
usage must have a consistent way of accessing these functions, as achieved thru vtables of function pointers in the actual objects (C++) or equivalent, providing statically-typed dynamic binding (this is really just defining simple function pointers with static typechecking in the base class, and filling them in in the derived class, along with offsets to reset the receiver).

The run-time selection of methods is another case of dynamic binding, meaning lookup is performed (bound) at run-time (dynamically). This is often desired and even required in many applications including databases, distributed programming and user interaction (e.g. GUIs).
Example: A cut operation in an Edit submenu may pass the cut
operation (along with parameters) to any object on the desktop, each of which
handles the message in its own way (OO). If an (application) ...

Solution Summary

Dynamic binding and its role in object-oriented programming are explained. The difference between functional and imperative programming languages is explored. Dominance of LISP in the Artificial Intelligence is explained.