Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#574 Please auto pull-up method

open
nobody
5
2012-03-29
2012-03-29
Luke
No

Can you add the functionality described on pg. 322 of Martin Fowler's Refactoring book?

I have classes B and C which have a duplicated method:

class ClassB(object):
def duplicatedMethod(self)
print ("Hi")

class ClassC(object):
def duplicatedMethod(self)
print ("Hi")

I would like a refactoring option to create a new base class (or add to it) such that the selected method is automatically populated on the base class.

So after running the refactoring I would have:

class ClassA(object):
def duplicatedMethod(self)
print ("Hi")

class ClassB(ClassA):

class ClassC(ClassA):

Discussion