I'm trying to draw a sequence diagram for a code which looks like this:
Class Z:
method y()
Class X:
method w()
Class A inherits X & Z:
method b() {
calls y()
calls w()
}
A a;
a.b()
At first I thought that I should draw a self message method like this:
┌─┐
│A│
└┬┘
┌┴┐
│ │────┐
│ │ │ b()
│ │<───┘
│ │
│ │
└┬┘
┌┴┐
│A│
└─┘
but then I realised that this doesn't show how b()
calls y()
, so I considered this:
┌─┐ ┌─┐ ┌─┐
│A│ │Z│ │X│
└┬┘ └┬┘ └┬┘
┌┴┐ y() │ │
│ │ ─────────>│ │
│ │ │ │
│ │ w() │
│ │ ──────────────────────>│
└┬┘ │ │
│ return │
│<─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
┌┴┐ ┌┴┐ ┌┴┐
│A│ │Z│ │X│
└─┘ └─┘ └─┘
But then this one doesn't show b()
. Is there a way I can draw this sequence diagram so that I can show both methods?
The call of b seems to be made out of something associated to a class, so let say the initial caller is not important using a found message, then y and w are applied on the instance of A executing b whatever these operations are inherited, so :