0

Suppose you write a subclass that extends to a certain class and in that subclass, you use the super() method for your constructor.

Would you write "super(parameter: type): return type" in the UML?

1

No, in the large majority of cases, the super() call would not be reflected in your UML.

  • super is not the name of an actual method (it is a language construct to call the super-class constructor), so you should not add it in the class diagram.
  • In sequence diagrams, you might show the super() call if you want to show the parameters being passed on the the super class. In most cases, that information isn't all that useful or relevant for what you want to show in the diagram, so it is left out. If you do draw the super() call, it would be a self-call.
  • The only other place where you might see the super() call is in the documentation of the constructor itself, if you use the UML diagrams to generate code from.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.