C ++类图和{query}

问题描述 投票:1回答:1

我正在尝试学习UML类图+ c ++,但我偶然发现{query}在操作后被使用。例如,图中的类图在操作后确实具有{query}

enter image description here

[注意,我(参考符号)表示& symbol (const std::string&){query}在代码方面会是什么样子?有小费吗?

构造函数应该将参数保存到属性,然后成员函数将其返回。

谢谢你。

c++ uml class-diagram
1个回答
0
投票

根据第UML 2.5中的116:

<oper-property>表示操作的属性。

<oper-property> ::= ‘redefines’ <oper-name> | ‘query’ | ‘ordered’ | ‘unordered’ | ‘unique’ | ‘nonunique’ | ‘seq’ | ‘sequence’ | <oper-constraint>

where

  • ‘query'表示该操作不会更改系统状态。

基本上,您可以将其视为属性的实现。

© www.soinside.com 2019 - 2024. All rights reserved.