Home > Back-end >  UML Class Diagram: Object passed through constructor relationship?
UML Class Diagram: Object passed through constructor relationship?

Time:11-19

Suppose I have a class like this in Java:

public class ClassA{
     public ClassA(ClassB b){
          // do some operations or get some values etc. from ClassB b

ClassB is passed to ClassA through its constructor. (not a method) Is this relationship considered a dependency or some form of association? If we were to assume that there is no ClassB attribute in ClassA.

CodePudding user response:

This would normally be a dependency or 'uses' relationship. Association implies a 'has-a' relationship.

  • Related