C#:帮助了解<<< property>>>在UML类图中 [英] C#: Help understanding <<property>> in UML Class Diagrams

查看:44
本文介绍了C#:帮助了解<<< property>>>在UML类图中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在做一个项目,我们必须从UML图制作代码.我了解UML类图的剖析,但是我难以理解<< property>> 的含义以及如何将其实现到我的代码中.

I am currently doing a project where we have to make code from UML diagrams. I understand the anatomy of a UML class diagram but I'm having trouble understanding what <<property>> means and how to implement it into my code.

推荐答案

<<属性>> 是一种刻板印象(就像UML中大多数东西都被<<>> ).在这种情况下,它指示您应为相应命名的类的私有属性实现getter和setter.例如.对于 Status ,您将实现 getStatus setStatus (或用于此目的的目标语言).由于还存在 Name 的约束 {只读} ,因此您只需实现 getName .您可能不得不猜测该属性的名称是 _bookName .

<<property>> is a stereotype (like most things in UML embraced by << >>). In this case it indicates that you shall implement getters and setters for the accordingly named privately owned attributes of the class. E.g. for the Status you would implement getStatus and setStatus (or whatever is used in the target language for that purpose). As there's also the constraint { readonly } for Name you shall just implement getName. You probably have to guess that the attribute's name is _bookName.

这篇关于C#:帮助了解&lt;&lt;&lt; property&gt;&gt;&gt;在UML类图中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆