Representing inner class or containement in class diagram

+1 vote
asked Jul 28, 2015 in Wanted features by Pierre.Sassoulas (200 points)
Hello,

I would like to make a class diagram with an inner class. It seems it is possible in UML but I did not find the plantuml equivalent of this : http://www.holub.com/goodies/uml/index.html => Nesting, Inner Class

As now, I'm using this :

class Myclass << (I,orchid) InnerClass >>  {
}

1 Answer

+2 votes
answered Jul 28, 2015 by plantuml (295,000 points)
selected Jul 29, 2015 by Pierre.Sassoulas
 
Best answer

Hi,

This is not very documented, but you can have:

class foo1
class foo2
foo1 +-- foo2

 

Is this what you are looking for ?

commented Jul 29, 2015 by Pierre.Sassoulas (200 points)
Yes that's exactly the thing I was searching for. To be fair I almost tried it without reading the doc, but then I searched in the doc and thougth it did not exists. Maybe this simple example should be added in the "Relations between classes" paragraph of classes.html.
commented Aug 13, 2021 by bav0016 (100 points)
There is a problem with this approach: in order to draw a link to foo2 one should refer to it directly without respecting the namespace scope: foo1::foo2 won't work.
...