inheritanceumldiagramclass-diagrammultiplicity

UML diagram multiplicity notation


I have a question about my UML diagram. I have made a system consisting of a "User" parent class and the two child classes inherit from the "User". Now my question is how to show the multiplicity notation between them, just like the multiplicity notation is shown between "Booking" and "client", where more clients can only have one booking each and the notation would be many to one.

The question is:

What is the right way to write it? Is it wrong to write multiplicity notation when a class inherits? Please help I have spend like 2 hours on figuring it out.

UML DIAGRAM PICTURE


Solution

  • You don't. There are no multiplicities on a Generalization in UML.

    The fact that your User is either a Cient or Practitioner can be expressed by setting your User abstract. The notation for abstract classes is to set the name in italic. This way you cannot instantiate User instance directly, but you have to use one of the concrete subclasses.

    The second phrase doesn't really constrain anything, so you don't have to mention it at all.

    Remark: the guillemets « and » are reserved in UML to denote stereotypes and keywords. As it is right now your User class is really an unnamed class with stereotype «User»