17

In a class diagram, is there a way of specifying that a class is an internal class of another class ?

Or is it considered as a pure implementation choice ?

4 Answers 4

12

Consider using a nesting relationship (a line with a '+' in a circle at the parent end).

Sign up to request clarification or add additional context in comments.

2 Comments

I can't find this link in StarUML. Am I missing something?
As of '19, it is the Toolbox, Packages section, Containment relationship. It could have been not present at the time, thou.
7

Since UML isn't supposed to be directly implementation specific, I'd use a naming convention, such as:

OuterClass vs OuterClass::InnerClass

I would imagine if you're hoping to reverse-engineer or code-generate to/from UML that different tools would us different techniques (if they support it at all).

A quick test of some reverse engineering using Enterprise Architect (EA v7) confirms that they use the above InnerClass::OuterClass syntax when processing some C# with a public inner class.

1 Comment

I will use the "nesting relationship" that chimp talked about, but your idea was good as well, thanks !
1

For this kind of thing you have separate Diagrams showing the internal structure or processing of a class.

usually, those extra diagrams are activity diagrams to show processing. Sometimes one per method. You might also have an internal sequence diagram showing the API interactions.

No reason you can't have an additional class diagram to show internal structure of a class.

Comments

0

Or you can show the inner class fully enclosed by the outer class, one rectangle inside another.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.