Inheritance (general description)

The toggle button activates or deactivates inheritance .

A green button means that inheritance is active. Then the object inherits, i.e., uses, the value from the parent object from which it was derived. When you modify the value of the parent object, the program also modifies the value of the child object.

Let us illustrate this with an example. We derive the ParallelStation in the Class Library and insert it from the Class Library into the Frame Model1. Then, we derive Model2 from Model1. The origin of the ParallelStation in Model2 is the ParallelStation in Model1. When we now change the value of an attribute that inherits its value in the ParallelStation in Model1, the ParallelStation in Model2 also applies this value.

An orange button with a minus means that inheritance is not active. Values you select or enter only apply to the selected object.

Note that the object might display the current value only after you click Apply.

To terminate inheritance relations of the selected object to the object from which it was derived, right-click it and select Cut Inheritance on the context menu. Then, the object inherits its settings from the origin of the origin. In case the origin does not have an origin, the object does not inherit settings at all.

Related Topics

Cut Inheritance

Using Inheritance

Introducing Classes

Working with Classes in the Class Library

Modeling Hierarchically

Inheritance in the window Show Attributes and Methods

Inheritance box in the user-defined Dialog

Class

A class provides the template for an Instance, which you insert into a Frame. All objects in the Class Library, those we built-in as well as those you yourself define, are class objects. You can add more detail to these classes and thus create new classes that inherit properties from the original classes.

By changing a property in the class object, you change that property for all derivatives of this class. This is much less error-prone than having to change the same property for each and every individual object.

  • A class passes all of its properties on to an Instance you derive from it.

  • A class passes those of its properties on to a Subclass you derive from it, for which you do not deactivate inheritance.

    Note:

    Inheritance only works from class to subclass/instance, not the other way around!

SimTalk:

class

Related Topics

Open Class in the dialog of the objects

Go to Class in the dialog of the objects

Subclass

A subclass is an object in the Class Library, which inherits some, but not all, of its properties from another Class. By deactivating Inheritance for certain dialog items, you can define properties that only apply to this subclass.

Note:

Inheritance only works from class to subclass/instance, not the other way around!

Instance

An instance is an object you insert into your simulation model from the Class Library or the Toolbox by dragging a class object to a Frame and dropping it there. An instance inherits its settings from its class.

Note:

Inheritance only works from class to subclass/instance, not the other way around!

SimTalk:

childNo

NumChildren

getAttribute

Related Topics

Show Inheritance

Duplicate