Inheritance Class Diagram

The classes in the model can inherit from other classes. The inheritance diagram shows the hierarchy of super and subclasses.

The inheritance is an important concept in object-oriented analysis and design. A subclass can inherit structure and behavior from its superclass (or multiple superclasses). The inheritance diagram shows the inheritance hierarchies. The inheritance trees can have multiple levels. For extensive hierarchies, it is recommended to divide them into multiple diagrams.

There are two main types of inheritance:

  • Single Inheritance - a subclass inherits its structure and behavior from a single superclass. (It can be implemented in most object-oriented languages.)
  • Multiple Inheritance - a subclass inherits its structure and behavior from multiple superclasses. (It can be implemented in C++. It can be substituted with interface inheritance and implementation in other object-oriented languages.)
Inheritance in UML Class Diagram
Inheritance in UML Class Diagram

Inheritance in UML Class Diagram

The inheritance is modeled using classes connected with the generalization relationship. The UML generalization is depicted as a line with a triangular arrow that points from a subclass to its superclass.

How to Create Inheritance Hierarchies

Using Software Ideas Modeler you can create inherited structures very easily. Select a class and click on the button with the desired action in the context bar:

  • Add Sub Class - inserts a new subclass under the selected class.
  • Add Super Class - inserts a new superclass for the selected class above.
Adding Sub- and Superclass to Class Diagram
Adding Sub- and Superclass to Class Diagram

New Comment

Comment