如何使用 UML 在构造函数中表示 Java "this" 关键字

How to represent the Java "this" keyword in a constructor using UML

假设我们有:

class A {
    A(B theB){
    }
}

class B {
    B() {
        A theA = new A(this);
    }
}

A和B之间的关系应该如何用UML表示?

这就是交叉依赖。

如果您持有一个 class 的 属性 另一个 class ,您会将其显示为关联。但在这种情况下,它只是一个依赖项。