Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Representing An Association and Inheritence in UML

If I had a class definition that looked like this:

class A extends class B {
private B b
}

How could I represent this relationship in UML? Also is this a bad design and why?

like image 932
user10357462 Avatar asked Dec 02 '25 22:12

user10357462


1 Answers

The extends keyword in Java stands for a generalization, shown as a hollow triangle in UML.

The association is shown as a solid line. The role name b is attached towards the B class with a - prefix for a private one. And the large dot tells that it's an owned property of A.

There's basically nothing wrong with that.

enter image description here

like image 163
qwerty_so Avatar answered Dec 04 '25 10:12

qwerty_so



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!