简体   繁体   中英

C++ Class diagram and {query}

I am trying to learn UML class diagrams + c++ and I stumbled upon {query} being used after operation. For example class diagram in picture does have {query} after operation.

在此处输入图像描述

Notice that I the (ref symbol) means & symbol (const std::string&) . What would {query} look code wise? Any tips?

Constructor is supposed to save parameter to attribute and then member function would return it.

Thank you in advance.

According to p. 116 of UML 2.5:

<oper-property> indicates the properties of the Operation.

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

where

  • 'query' means that the Operation does not change the state of the system.

Basically you just can think of that as implementation of a property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM