Change class element to interface element

自作多情 提交于 2019-12-23 07:28:32

问题


When modelling a class diagram the toolbox contains special objects for a class and for an interface. They differs by their icons which are shown in the Project Browser if they were added to a diagram. (Their properties seems to be the same.)

Is it possible to change an object which was created as class to an object of type interface? Or do I have to delete the class and create a new interface?


回答1:


Yes, it's possible and quite simple.

Select the class and look at the Element Properties window (if it isn't visible, select it in the View menu). The Properties window has three branches: Class Settings (or Interface, etc), Project, and Advanced.

If you look under Class Settings, there's a field called Type with an ellipsis button (...). Select that, and you can change the element type to Interface or any other type you wish.

Be aware that you may need to double-check the element properties once you've changed the type. For instance, changing a simple Class to an Interface is pretty straightforward. If on the other hand you change an Interface to a Class, the class will be abstract (because an Interface is) and retain the "interface" stereotype.



来源:https://stackoverflow.com/questions/6871161/change-class-element-to-interface-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!