Should I put deleted method or member function in an UML class diagram, i.e. for example for a class like this:
class ProfilometerManager
{
int a = 6;
public:
ProfilometerManager(ProfilometerManager& other) = delete; //can not be cloneable
ProfilometerManager& operator=(const ProfilometerManager&) = delete; // can not be assignable
};
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= deletebehind 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
=deletein 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:
«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.