Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UML Class Diagram with Inheritance and Interface

I'm trying to understand how can I draw a UML diagram of a program that extends one class and implements another interface. I've made this sketch but I'm not sure if it is correct.

A is a class that has some fields and methods and B is an interface which has some methods. And finally C is extending from A and implements B. ( like public class C extends A implements B in java)

enter image description here

like image 355
azuosxela Avatar asked Apr 17 '16 11:04

azuosxela


People also ask

How do you show inheritance in UML diagram?

Inheritance is shown in a class diagram by using a solid line with a closed, hollow arrow. Bidirectional association: The default relationship between two classes. Both classes are aware of each other and their relationship with the other. This association is represented by a straight line between two classes.

Can UML diagrams show interfaces?

In UML 1.4 interface was formally equivalent to an abstract class with no attributes and no methods and only abstract operations. An interface may be shown using a rectangle symbol with the keyword «interface» preceding the name.

WHAT IS interface in UML class diagram?

In UML modeling, interfaces are model elements that define sets of operations that other model elements, such as classes, or components must implement. An implementing model element realizes an interface by overriding each of the operations that the interface declares.

What is class diagram in UML with example?

Class diagram describes the attributes and operations of a class and also the constraints imposed on the system. The class diagrams are widely used in the modeling of objectoriented systems because they are the only UML diagrams, which can be mapped directly with object-oriented languages.


1 Answers

Your diagram is almost correct. The left generalization is drawn like a unfilled triangle.

enter image description here

Edit: In Enterprise Architect you can show the generalization also with the general class written in italics top right of the generalizing class:

enter image description here

Obviously this is a pure Sparxian invention as their support does not have an explanation for its origin.

like image 147
qwerty_so Avatar answered Oct 15 '22 18:10

qwerty_so