3

I have a project where class Foo has a member function which takes class FooParam as a parameter. Now I want to draw a UML class diagram representing the relationship between class Foo and FooParam.

From the options on the table, inheritance, implementation, aggregation and composition are automatically excluded. Thus, the options that are left are association and dependency, but to my eyes none of them fits quite right.

Given the options, how exactly do we model method parameters in class diagrams?

1
  • 1
    Not all items of a class diagram are expressed visually. The type of an operation parameter (FooParam in your example) can be expressed textually in a class diagram. If you are not happy with this, you can add a dependency arrow from the Foo class to the FooParam class. Commented Mar 16, 2022 at 11:15

1 Answer 1

2

I agree with Gerd, you will not see a "link" or "relationship" between Foo and FooParam classes. I put below what you should see by default.

enter image description here

Of course, you can always add an explicit link (as a dependency for example) but it is, for me, duplication of the information...

enter image description here

The best is maybe to have a tool which would be able to compute this "link" or "relationship" and show it to you in some way.

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

1 Comment

(It Gerd, not Gred ;-) The dependency below is a bit off and should not come from inside the class frame.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.