Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uml classdiagram constructor with parameters

I am a complete ROOKIE at this so I need some help on it.

How would you create uml class diagram and constructors with parameters.

for default (no parameters) you do

policyholder() for diagram and pseudo-code

for parameters would you do the same thing

policyholder (policynumber, service class, and customer age) for class diagrams and pseudo-code.

It also asked to initialize each attribute to value where an object of this type can be instantiated, If a policy number is not between 1000 and 999 inclusive, then set the policy number to 0. (policy number is attribute)

like image 674
blake Avatar asked Oct 24 '10 01:10

blake


People also ask

Do you include constructors in UML class diagram?

Describing class methods In a class diagram, we list all class methods including the constructors; constructors are listed first and then all class methods. We also write the return type of a method in the class diagram.

Do you include parameters in class diagram?

The arg list is a list of parameter types (e.g., int, double, String); parameter names are not included in the UML class diagram.


1 Answers

The common way is to write constructors like methods and simply omit the return type.

enter image description here

If you want to be extra clear, you can add <<constructor>> in front.

like image 85
magnattic Avatar answered Oct 06 '22 17:10

magnattic