Inheritance concept

Previous chapterNext chapter Show allShow all    Hide allHide all

Inheritance means, that the properties of an object are passed on to an object based on the first one. The inherited object in principle gets all properties from the basic object, but single properties or even all can be changed = overwritten.

In contrast there is also the prossibility of linking. Here again the new object gets all the properties from the basic object, but they cannot be changed/overwritten in the basic object. Changes are only possible in the basic object.

For both cases the following is true: If a property in the basic object is changed, all objects based on this basic object are also changed. So the single properties are not saved in the object, there is only a reference to the basic object.

Exception: As soon as a value is overwritten (changed), this property loses its reference to the basic object. If such an overwritten property is changed in the basic object, these changed no longer effect the inherited object. This is only true for the properties that lost their reference to the basic object. All other properties still have their reference to the basic object. An overwritten property can at any time be changed back to a referenced property.