I need to create an UML Class Diagram and I am not sure if I've done it correctly.
I will show you on example.
So ClassA has an instance of ClassB and ClassA calls methods from ClassC which take as attributes variables from ClassA and ClassB. Should I connect also ClassC with ClassB? Does the association between ClassA and ClassB should be directed? The implementation of the code below:
ClassB {
constructor() {
this.str1 = "Hello";
}
}
ClassA {
constructor() {
this.str2 = "World";
this.objB = new ClassB();
}
funA() {
let objC = new ClassC();
objC.function1(this.objB.str1);
objC.function2(this.str2);
}
}
ClassC {
constructor() {}
function1(stringFromB) {
console.log(stringFromB);
}
function2(stringFromA) {
console.log(stringFromA);
}
}
let objA = new ClassA();
objA.funA();
Thanks for any help :)