The UML notation does not support this notation. The UML specifications define a syntax with =
for default values of attributes but not for operations (member function). A suffix = delete
behind an operation in a class-diagram would be syntactically incorrect and confusing for most of the readers, even if C++ practitioners would understand it. Therefore you should not use such a notation (even more if considering it as an implementation detail).
UML has no build-in way to express the absence of an operation in the same way than =delete
in C++: if an operation is not shown on an UML diagram, it can mean that it does not exist or that it exists but is simply not relevant for the purpose of the diagram.
In this regard, if the deletion would be vital for your design:
- if this is rather rare, the simplest way would be to add a note to the class, in plain text.
- if this is very common and important in your domain, you could consider defining a stereotype in an UML profile, i.e.
«Deleted»
.
If it is not really the deletion of individual member functions which is important for your design, but their effect for the class (e.g. «not copiable»
as suggested by Pepijn Kramer's comment), you may better express this with ad-hoc class stereotypes. This would be far more expressive and you could map the design to implementation rules without getting lost in too much details.