Inheritance and Static Attributes

Like all components, static attributes exist only once per inheritance tree. A subclass can access the content of the public and protected static attributes of all superclasses. Vice versa, a superclass shares its public and protected static attributes with all subclasses. Thus static attributes are not assigned to one single class but to a section of the inheritance tree. Changes can be made from outside using the class component selector with all class names involved or from inside in all associated classes and are visible in all classes involved.

When a static attribute is addressed that belongs to a section of an inheritance tree, the class where the attribute is declared is always addressed irrespective of the class name used in the class component selector. This is important for calling the static constructors of classes in inheritance. A static constructor is executed when a class is addressed for the first time. When a static attribute is addressed via the class name of a subclass but is declared in a superclass, only the static constructor of the superclass is executed.