Inheritance in NewtonScript

Proto Inheritance

Now that you have an introduction to inheritance by difference, we can discuss the first of its two forms: proto inheritance. Proto inheritance is accomplished via a slot named _proto that points to the object's proto. Let us revisit in FIGURE 4.2 our two sample objects to help clarify the relationship between an object (copyCat) and its proto (original). copyCat now contains a _proto slot. This slot still points to original, which copyCat inherits from and which now serves as its proto. We say that copyCat protos from original. The other mechanics of inheritance are still the same; all of original's slots are available in copyCat, except for text, which is still an overridden data slot.

FIGURE 4.2 : One frame protoing from another.


Proto Inheritance and Inheritance Lookup
Multiple Protoing
Slot Assignment
The inherited Keyword
The deeply Version of foreach

An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996