How are relationships inherited in a UML class diagram?

I was wondering how associations, dependencies and such relationships are inherited in UML (or, say, in general). So in this situation:

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  ClassA  β”‚                                        β”‚  ClassB  β”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€                                        β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚          │─────────"One kind of relation"────────>β”‚          β”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€                                        β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚          β”‚                                        β”‚          β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        ^
       /┬\
        β”‚
        β”‚
        β”‚
        β”‚
  β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
  β”‚  ClassC  β”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚          β”‚
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  β”‚          β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Note:

  • ClassA-ClassC is in relation to generalization, the arrow must be solid.
  • ClassA-ClassB is in one of [dependency, association, aggregation, composition]
  • Unicode is cool, but with an editor font it looks much better :)

My question is: how are these relationships inherited? For example, when ClassA depends on ClassB, will ClassC depend on ClassB? and etc.

Thank.

+3
source share
3 answers

You are not asking a UML question, you are asking a more general question.

What does inheritance mean?

ClassC ClassA. , , ClassC ClassA.

, , , , ClassA ClassC.

. . UML.

+1

- ( , ).

, ; , :

, , . - . , . - . - , , , "". . , - UML. , , .

2003 . , UML Distilled, Third Edition, " ":

, a , Corporate , , . - .

.

- , :

- : . OO , .

, :

- . :

  • -

.

:

  • :
  • ,

Rectangle Square, , .

( , ), .

, .

+2

Since inheritance is an "is-a" relation (no pun intended), you can read it as "ClassC is ClassA that knows ClassB", therefore:

For example, when ClassA depends on ClassB, will ClassC depend on ClassB?

- Yes:)

+1
source

Source: https://habr.com/ru/post/1727027/


All Articles