类 UML 图 - 快速问题
我有一个计算器课和一个主课。如果我要在主类中创建一个计算器对象,它将是...“主类有一个计算器”main<--calculator.但是,如果我从主类内的计算器类调用方法函数,这将如何(因为我没有创建计算器的实例,所以这两者之间有任何关系)吗?
i have a calculator class and a main class. If i were to create a calculator object inside the main class, it would be ... "main class has a calculator" main<--calculator. However, if i call method functions calls from calculator class inside the main class, how will this look/be (since im not creating an instance of calculator, is there any relationship between these two)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的主类调用计算器上的方法,但不创建、拥有或保留对计算器的永久引用,则描述它们之间关系的最佳方式可能是“依赖关系”。
请参阅此维基百科页面上的“依赖关系”部分标题:
http://en.wikipedia.org/wiki/Class_diagram
其右侧是一幅描绘“依赖性”视觉表示的图片——请注意箭头上“使用”一词的使用。
If your main class calls a method on calculator, but doesn't create, own or keep a permanent reference to the calculator, the best way of describing the relationship between them might be "Dependency".
See the section title "Dependency" on this wikipedia page:
http://en.wikipedia.org/wiki/Class_diagram
To the right of it is a picture depicting a visual representation of "dependency" -- note the use of the word "uses" on the arrow.