How do I denote a pure virtual function in a UML class diagram?

john grey picture john grey · Nov 12, 2018 · Viewed 13.2k times · Source

I am a student learning C++. I am creating a UML class diagram for my program that involves inheritance and abstract / concrete classes, but I'm not too sure how I would denote a pure virtual function. Any help is appreciated, thank you!

Answer

Christophe picture Christophe · Nov 12, 2018

The UML standard does indicate that a behavioral feature (e.g. a method/operation) can have its property isAbstract set to indicate that it is abstract and has no implementation. There is however nothing about how this should be shown in the diagram.

According to uml-diagrams.org and other sources, in older UML versions (1.4.x), an abstract operation was shown with a name in italic or with a textual {abstract} marker following its name. The italic convention was widely used (See also here).

The current UML doesn't use anymore use italic and does not indicate how to represent the isAbstract property. Nevertheless, the {abstract} marker should still be valid.