Enterprise Architect 中的继承
我在包中有一个类。我在另一个包中有另一个类。我想将第二类与第一类联系起来。因为第一个是第二个的遗产。我无法建立这种关系。我们尝试过,但两种方法都没有采用第二种方法。
欢迎任何帮助。 谢谢
A 类
B 类
A 类的所有权应该在 B 类中可见。其中 A 和 B 位于不同的文件夹中。 B,我放置了 A 的“实例”。
I have a class within a package. And I have another class in another package. I would like to link this second class to first. Since the first is a legacy of the second. I'm not able to make this relationship. We tried, but in neither case are the methods of the second brought the first.
Any help is welcome.
Thanks
Class A
Class B
The ownership of Class A, should be visible within the class B. Where A and B are in different folders. And B, I put an "Instance" of A.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
显然,您需要在包含这两个类的某个图表中创建这种关系。请记住,您可以有多个图表链接到某个(其他)包/命名空间中的同一个类。
创建一个专门处理继承(和其他关系)的新图表,如下所述:http:// /www.sparxsystems.com/WhitePapers/Version_Control.pdf
或者,您只需将外部类拖到您当前正在处理的图表上,创建关系,然后删除外部类。这种关系将会持续下去。请注意,您不应在项目视图中拖/放/删除类,因为这将导致包发生更改。
第一个解决方案的优点是存在关系的实际 UML 表示。另一方面,仅针对跨包关系添加另一堆图表可能会使项目视图变得混乱,但这毕竟取决于您:)
Apparently, you need to create this relationship in some diagram that contains both classes. Remember, you can have multiple diagrams that link to one and the same class in some (other) package / namespace.
Either create a new diagram that exclusively handles the inheritance (and other relationships) as described in here: http://www.sparxsystems.com/WhitePapers/Version_Control.pdf
Or, you just drag the foreign class onto the diagram you are currently working on, create the relationship and then remove the foreign class afterwards. The relationship will persist. Note that you should not drag/drop/delete the class in the project view as this will lead to changes in the packages.
The first solution has the advantage that there is an actual UML representation of the relationship. On the other hand, adding another bunch of diagrams for just the cross-package relationships might clutter the project view but this is up to you after all :)
您想要建立什么样的联系(他们关系的本质是什么),目的是什么?
编辑:我还没有使用 EA 进行任何正向工程,所以我不确定完成你所追求的事情的最佳方法,但我确实部分< /strong> work:
我尝试了这个并且它有效 - 但仅适用于方法而不适用于我创建的属性。
What sort of link are you trying to establish (what's the nature of their relationship), and for what purpose?
Edit: I haven't yet used EA for any forward-engineering so I'm not sure of the best way to do what you're after, but I did get it to partly work:
I tried this and it worked - but only for the methods not for the attributes I'd created.
我已经搜索了手动添加继承的解决方案,例如:我将在我的类或接口上看到
C#
中的IDisposable - 接口
,而无需此接口在我的项目中声明。您可以通过以下方式执行此操作:选择类或接口并按 [STRG + I]
或者在图表中选择类/接口并浏览上下文菜单:高级 ->家长。
在下面的对话框中,您可以从项目中选择一个类、接口,或者在文本字段中输入
新名称
,选择Generalize
或Implements
从下拉菜单中按添加
。企业架构师12
I've searched for a solution to add the inheritance manually, e.g.: I´ll see the
IDisposable - interface
inC#
on my class or interface without I've this interface in my project declared.You can do this by following: Select the class or interface and press [STRG + I]
or select the class/interface in diagram an go over context menu: Advanced -> Parent.
In the following dialogue you can select a class, interface from your project or type an
new Name
in the text filed, select theGeneralize
orImplements
from drop down and pressAdd
.Enterprise Architect 12