Monday, March 05, 2007

Object-oriented programming deconstructed

Object-oriented programming is four things: an interface (that different class types can appear the same to a user via an interface, including that a more complex type can appear to be a simpler one), inheritance (code reuse through subclassing), function dispatch by type (many different classes might have a "run" method: the correct one is selected by the type of the object), and namespace control (managing what identifiers are visible where).

Dispatch by type has two components: static (type determined at compile time) and dynamic (at run time, the C++ idea of "virtual").

No comments :