Pull Members Up, Push Members Down
The Pull Members Up refactoring lets you move fields if two classes have the same field, or move methods if your subclasses have methods performing similar work. This helps you to get rid of duplicate code. You can also move class members to a superclass or an interface, or interface to superinterface.
The Push Members Down refactoring lets you clean up the class hierarchy by moving class members to a subclass or a subinterface. The members are then relocated into the direct subclasses/interfaces only. This improves internal class coherency.
- Select an item you want to pull up or push down.
- On the main or context menu, select or .
- In the dialog that opens, depending on your refactoring, specify a destination object, members you want to move, and other additional information.
- Click Refactor.
Pull Members Up example
| || |
Push Members Down example
| || |