12

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?

Kai
  • 38,985
  • 14
  • 88
  • 103

1 Answers1

26

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.

Uffe
  • 10,396
  • 1
  • 33
  • 40
  • 1
    Additionally you can also select the element in the diagram, and select the menu option `Menu | Element | Advanced | Change Type...` This option might be the safer one. – Geert Bellekens Jun 24 '16 at 03:30
  • 3
    Moreover you go to _Design tab_ on the ribbon → from Element section use _Manage_ menu → select _Change type_. – Mr. Tao Nov 22 '16 at 10:11