How to represent two different types of data being returned by a class method in a UML diagram?
Solution 1:
Besides the fact that this is a really bad implementation (you rather should return None
than False
) you would have the return type of what ever ìnvoice
would be (probably Invoice
). So assuming that it would just be
+getInvoiceById(id):Invoice
(I intentionally omit self
since it is a mandatory parameter in Python.)
The exception can be noted as a constraint like { returns False if no id found }
.