Parent Objects

From TinyMUX
Revision as of 18:57, 28 July 2006 by Nhoj (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Parent objects provide a way for several objects to inherit common attributes, exits, and $-commands from a single object, so that changing the parent object affects all of its children. When searching for attributes or exits, first the object itself is checked, then the parent is checked only if the object does not have what was searched for.

Any attribute the parent object has will be passed down to its children, if they don't already have one. For instance, if the child object has no description, it will inherit the description of its parent.

Any exits the parent object has will show up in the exit list of the child, and may be used as normal exits.

The parent is searched for $-commands as well as the child, and only attributes that are unique to the parent are checked, so that conflicting attribute names are skipped. If both have an attribute named "cmd1", only the child's "cmd1" attributes is checked for a $-command.

A parent object may itself have a parent, up to a configurable limit (usually 10 levels). The parent need not be the same type as its children, and flags and locks are not inherited from parent objects. You may not create parent loops.

Related Topics: Inheritance, @parent, parent(), parent_recursion_limit, ancestors.