[英]constructor with parameters in UML class diagram
How would you create an uml class diagram for constructors with parameters?您将如何为带参数的构造函数创建 uml 类图?
For default constructors (no parameters) you do对于默认构造函数(无参数),您可以
policyholder()
for the diagram and in the pseudo-code policyholder()
用于图表和伪代码For constructors with parameters would you do the same thing:对于带参数的构造函数,你会做同样的事情:
policyholder (policynumber, service class, and customer age)
for class diagrams and pseudo-code.policyholder (policynumber, service class, and customer age)
。 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)
如果策略编号不在 1000 和 999(含)之间,则将策略编号设置为 0。(策略编号是属性)
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.如果想更加清晰,可以在前面加上
<<constructor>>
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.