uml classdiagram constructor with parameters

♀尐吖头ヾ 提交于 2019-11-30 06:34:00

问题


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)


回答1:


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

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



来源:https://stackoverflow.com/questions/4006868/uml-classdiagram-constructor-with-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!