Pull Up refactoring

From Wikipedia, the free encyclopedia

In software engineering, Pull Up refactoring involves moving a method from a Subclass into a Superclass . Compare the following Java classes before and after the Pull Up refactoring is applied on myMethod2:

 public class Superclass{
 
     void myMethod(){
         //do something        
     }
 }
 
 public class Subclass extends Superclass{
  
     void myMethod() {
         //do something
     }
     void myMethod2() {
         //do something else
     }
 }

After the Pull Up refactoring is applied:

 public class Superclass{
   
     void myMethod(){
         //do something        
     }
     void myMethod2() {
         //do something else
     }
 }
 
 public class Subclass extends Superclass{
   
     void myMethod() {
         //do something
     }
 }

[edit] See also

Push Down