39

UML class diagram is a handy tool in object-oriented design. I am using it currently and facing presenting an abstract class with UML. I googled it but got nowhere.

So I would like to ask how to express an abstract class in UML class diagram, and it must be able to differentiate from concrete class

Rui
  • 3,454
  • 6
  • 37
  • 70

1 Answers1

66

You have to write the class name in italic :

enter image description here

Here Contexte is an abstract class and Structure is a "concrete" class

P. 99 of the specs says:

The name of an abstract Classifier is shown in italics, where permitted by the font in use. Alternatively or in addition, an abstract Classifier may be shown using the textual annotation {abstract} after or below its name.

Neuron
  • 5,141
  • 5
  • 38
  • 59
  • 3
    Cool! Thanks :) What if we add <> as a classifier? – Rui Sep 05 '17 at 08:14
  • 3
    Not standard, but a UML have to be readable and understandable. IMO a stereotype <> is understandable. But you will not be able to generate code with this kind of approximations. – Loïc Di Benedetto Sep 05 '17 at 08:35
  • https://en.wikipedia.org/wiki/Stereotype_(UML) from this seems the <> is a classifier other than a stereotype – Rui Sep 05 '17 at 08:42
  • Indeed, my bad^^ – Loïc Di Benedetto Sep 05 '17 at 09:22
  • @Rui: According to the UML specification, <> is a not a "classifier", but a stereotype, used to categorize modeling elements. The cited Wikipedia article is not based on the UML specification, so you should better not adopt its language/explanations. – Gerd Wagner Sep 05 '17 at 19:30
  • 2
    @GerdWagner Not correct. «abstract» is not UML 2.5 stereotype. P. 98: _The isAbstract property of Classifier, when true, specifies that the Classifier is abstract, i.e., has no direct instances: every instance of the abstract Classifier shall be an instance of one of its specializations._ – qwerty_so Oct 06 '20 at 23:35