简体   繁体   English

类图的替代

[英]Alternative for the Class diagram

Can anyone suggest me an alternative diagram for this ? 有人可以为此建议我一个替代图吗? I'm just confused with this question.. 我只是对这个问题感到困惑。

在此处输入图片说明

The alternative could just add things that you haven't included in the original, for example I can suggest instead of just 'changeTime' method to the Clock class, add a 'setTime' or a constructor that initializes the Clock. 替代方法可能只是添加您未包含在原始文件中的内容,例如,我可以建议在Clock类中添加“ setTime”或用于初始化Clock的构造方法,而不仅仅是“ changeTime”方法。 Then you need to explain why that differences would be better. 然后,您需要解释为什么这种差异会更好。

This is my example, but I think you could add a few more things, just explain why it's better or worse than the original. 这是我的示例,但我认为您可以添加更多内容,仅说明为什么它比原始版本更好或更差。
Ok, here's an example class, I've drawn it roughly... 好的,这是一个示例类,我已经大致绘制了它。

Clock
_____
# hour:byte
# minute:byte
# second:byte
____________
+changeTime(hour:byte,minute:byte,second:byte)
-setTime(hour:byte,minute:byte,second:byte)

^
|
|

Travel Clock
...

Now, you tell me why it's better - definitely it's better. 现在,您告诉我为什么会更好-绝对会更好。
Made setTime private, so it's for initialization and internal use only. setTime私有,因此仅用于初始化和内部使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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