Inheritance -- incremental modification
- Result = Parent + Modifier
Example:
Independent attributes: M disjoint from P
Overlapping attributes: M overrules P
Dynamic binding
-
slide: Inheritance as incremental modification
For example, we may define the record consisting
of attributes by adding
to the parent .
Clearly, we must make a distinction between
independent attributes (that occur in either
P or M) and overlapping attributes (that occur
in both P and M and are
taken to be overruled by the definition given in M).
An important property of objects,
not taken into account in our interpretation
of object as records given before, is that
objects (as supported by object-oriented languages)
may be referring to themselves.
For example, both in the parent and the modifier
methods may be defined that refer to a variable this or
self (denoting the object itself).
It is important to note that the variable self is dynamically
bound to the object and not (statically) to
the textual module in which the variable self occurs.
[