Show TOC

 Moving Components to an InterfaceLocate this document in the navigation structure

Use

If required, attributes, methods and events of all visibility sections of a class can be moved to an interface implemented by the class. However, the components may no longer be visible after that because interfaces have only PUBLIC components.

Caution

A conflict could occur if a method that you move to an interface has already been redefined in a subclass. In that case, the subclass must redefine another method, namely the interface method. The Refactoring Assistant recognizes this situation and performs the necessary adjustments in the subclass for you.

Tip

Create an alias name for each component that was moved. This prevents the users of these components from being invalidated.

Procedure
  1. Select the class.
  2. Make sure you are in Change mode.
  3. Choose Utilities → Refactoring → Refactoring Assistant.
  4. Select the class component to be moved and move it to the name of the interface using Drag & Drop.
  5. Choose Save.
Result

The moved class components are created in the interface. All PRIVATE and PROTECTED components are automatically assigned PUBLIC visibility. If methods with existing implementation were moved, the implementation is retained.