Search code examples
umlfriend

Depicting friend relationship between classes in UML


I have two classes A and B where B is a friend of A.

How to show this in UML ?

Is it ok to show it using dependency relation and then adding a comment on the relation like below ?

  <<Friend>>

B ------------------> A


Solution

  • Yes, that's perfectly valid. For my own questions about UML, I found this website particularly helpful.