[英]Class Diagram if the relationships are correct
I created a Class Diagram. 我创建了一个类图。 This is just a concept but i want to know if the relationship are correct and if i fully understand it. 这只是一个概念,但我想知道这种关系是否正确以及我是否完全理解它。
MainClass 主类
ClassAA AA级
Relationship from ClassAA to ClassBB is this suppose to be a composition? 这是从ClassAA到ClassBB的关系吗? since the classAA is the creator of ClassBB and it depends on it from existing The relation between InterfaceAA and ClassAA is realization. 因为classAA是ClassBB的创建者,并且它依赖于现有的ClassBB,所以InterfaceAA和ClassAA之间的关系是实现。 I wasn't able to draw the line using NClass diagram. 我无法使用NClass图画线。
ClassAA
and ClassBB
is composition only in case the instance of ClassBB
created by ClassAA
is stored inside ClassAA
and not shared with external entities. 仅在由ClassBB
创建的ClassAA
实例存储在ClassAA
内ClassAA
与外部实体共享的情况下, ClassAA
和ClassBB
之间的关系才是组合。 In this case it would be good OO practice to hide this implementation detail and perform the necessary initialization inside the ClassAA
's constructor or a dedicated Initialize
method. 在这种情况下,最好的做法是隐藏该实现的详细信息,并在ClassAA
的构造函数或专用的Initialize
方法内执行必要的初始化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.