Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How will inheritance is depicted in a sequence diagram?

Say method m of class A calls method n on class B, but the source code of class B does not contain n, since n is inherited from one of the superclasses of B.

How will the sequence diagram look?

Will there be message interaction between A and B by the method n or would it be with A and the superclass of B with by method n

like image 857
Kaushik Avatar asked Oct 22 '22 15:10

Kaushik


1 Answers

If you're to respect the principle of encapsulation, the interaction would purely be between A and B. The fact that B's implementation uses inheritance is of no concern to the code written in A - it's sole world view is that it calls the method on B.

You can safely change the implementation in B and not affect A. This is another reason to diagram the interactions this way.

like image 73
Dave S. Avatar answered Oct 25 '22 20:10

Dave S.