UML Inherited Property

Inheritance is usually explained in OOAD and in UML as some mechanism by which more specific classes (called subclasses or derived classes) incorporate structure and behavior of the more general classes (called superclasses, base classes, or parents). UML is inherently object-oriented modeling language and uses inheritance as one of its fundamental concepts while no UML specification provides appropriate details of how they actually define or interpret inheritance in UML.

UML 2.5 describes inherited members as some members of a parent classifier which were defined in the parent but behave as if they were defined in the inheriting classifier itself. An inherited member that is an attribute (or property in general) may have a value or collection of values in any instance of the inheriting classifier.

By default, the inherited members are members that do not have private visibility. In other words, all members of a parent are implicitly inherited except for those which have private visibility. This approach seemingly matches to inheritance definition in Java programming language but UML 2.5 specification provides no further details or explanations.

Until the UML 2.5 specification, inherited members had no specific notation. In UML 2.5 properties inherited by a classifier from a superclass may be shown on a diagram of the inheriting classifier by prepending a caret '^' symbol to the textual representation of the inherited property.

Example below shows Patient class with inherited attributes title, name, and birthDate with prepended caret '^' symbol. (See complete example at Hospital management domain UML diagram example.)

Patient class with inherited attributes title, name, and birthDate.

Patient class with inherited attributes
title, name, and birthDate.

Another inheritance example shows Button class with few attributes inherited from some GUI Control class. Inherited background property represents background image displayed in the control, isSelectable indicates whether the control can be selected. Cursor property gets or sets the cursor that is displayed when the mouse pointer is over the control, font is the font of the text displayed by the control.

Example of Button class inherited few attributes from Control class.

Button class inherits several attributes from Control class.

Inherited height and width attributes could be used to calculate derived property clientSize which represents the dimensions of the client area of the control. The client area of a control lies within the bounds of the control excluding nonclient elements such as title bar, scroll bars, menus, etc.

The Button class also has own properties - useMnemonic and textAlign. The useMnemonic attribute indicates whether the first character that is preceded by an ampersand (&) is used as the mnemonic key of the button. The default is true. The textAlign property gets or sets the alignment of the text on the button control with the default set as MiddleCenter alignment.

UML 2.5 also allows to show inherited attributes in a lighter color to help visually distinguish them from non-inherited properties. UML tools are not required to support this option.

Patient class with inherited attributes title, name, and birthDate shown with lighter color.

Patient class with inherited attributes title, name,
and birthDate shown with lighter color.