Generalizations can be used to define that one class inherits operations and attributes from another class. A generalization is the relationship from the child element (the more specific element, such as a subclass) to the parent element (the more general element, such as a super class) that is fully consistent with the first element and that provides additional information. In the example in figure Inheritance Using Generalizations, a generalization is drawn from class SimpleClass to class BaseClass.

Figure: Inheritance Using Generalizations

Private attributes are not inherited.

Thus, the class SimpleClass as modeled above has the following attributes:

Attributes of Class SimpleClassDefinition
  • privateSimpleAttribute
  • protectedSimpleAttribute
  • publicSimpleAttribute

defined in class SimpleClass

  • protectedBaseAttribute
  • publicBaseAttribute

inherited from class BaseClass

In figure Inheritance Using Generalizations, consider the output object simpleObject that is returned by the operation createSimpleObject of port type CreatorPortType. It will contain all attributes listed in the table above. You will not find the attribute privateBaseAttribute as it is declared private in class BaseClass and thus has not been inherited to class SimpleClass.

  • No labels