UML – Sequence Diagram for Abstract and Derived Class

abstract classsequence-diagramuml

I've a bunch of classes where one is Abstract class. I draw few derived class from that Abstract base class. For example,

class IBase{
public:
 *register(): bool*
 *update(): bool*
};

class Derived: public IBase{
 // implement register ()
 // implement update ()
};

class Derived2: public IBase{
 // implement register ()
 // implement update ()
};

while drawing the sequence diagram, I'm not sure, how to represent the interaction among abstract class and derived class. What are the standard in this regards?

Any help is highly appreciated.

Thanks.

Best Answer

In a sequence diagram, you model the interactions between lifelines. Each lifeline represent a different instance of a type (aka a different object).

So in principle you would represent IBase, Derived and Derived2 in the same sequence diagram, only if there were several different objets of these types. You would then have a distinct lifeline for each object. Their interactions would not depend on the inheritance between the types, but on the "messages" that are exchanged between the instances (e.g. function calls and returns).

You would therefore not show the interaction between a derived class and its base class in a sequence diagram, because both lifelines would in reality refer to the same object.