Inheritance

When a member appears in a statement, VTS looks first in the current module where the statement appears. If the member is found, it is used. If the member isn't found, VTS looks in the module's ancestors, starting with its parent, until the member is found. If the member isn't found in the system module, VTS reports an error: no such member exists. An ancestor can hold members which are meaningful to all its descendants.

This powerful object-oriented feature is called inheritance; an example of how it works follows:

A module called Motor is created as a member module of System. One of its member variables is Amps. Within Motor a member module called Display is created. Display has no member variable Amps. If a statement were entered in Display, which used the variable Amps, it will use its parent's variable Amps (which is Motor's member variable Amps).

When searching for a member, VTS always searches ancestors, never descendants. So, in the example, if Display had the member Amps, and Motor had no member Amps, and a statement was entered in Motor which used Amps, VTS would not find the Amps in Motor's child module Display.

If both Display and Motor had members called Amps, each would use its own member. This is because the current module is searched first. Note also that each Amps could have different values, and different types.

To use a descendant's member, a scope resolution operator, the backslash character '\', and an object value are needed.