UML relationship static call from another class

I am creating a class diagram, but I was wondering if there is any connection between the two classes shown below - as far as I understand, for the association, ClassA must have an instance of class B, which is missing in this case, however, it needs to be aware of the variable ClassB , so is there a connection between these two classes?

public class ClassA()
{
    int val = ClassB.x
}

public class ClassB()
{
    public static int x = 5;
}

      

+3


source to share


2 answers


Of course there is an association. You cannot use ClassA without an existing class.



+3


source


Yes, there is a connection between the two classes. A link is neither an aggregation nor a composition, it is a use / use dependency.

ClassA ------Uses-----> ClassB

      



Take a look at the link to learn more about the different types of dependencies

+3


source







All Articles