Java – represents Association and inheritance in UML

If I have a class definition similar to the following:

class A extends class B {
private B b
}

How can I express this relationship in UML? This is also a bad design. Why?

Solution

The extensions keyword in Java represents a generalization, which is displayed as a hollow triangle in UML

The association is displayed as a solid line The role name B is appended to class B and prefixed with a private symbol The bigger one tells it that it is a's property

There is basically nothing wrong with this

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>