像下面的两个类,除了调用不同版本的参数外,它们看起来几乎相同,那么如何重构它们呢?
import com.v1.B;
import com.v1.C;
class A1
{
public A1(B,C)
public dosomething1()
{
//do something with B and C
}
public dosomething2()
{
//do something
}
}
A2 类:
import com.v2.B;
import com.v2.C;
class A2
{
public A2(B,C)
public dosomething1()
{
//do something with B and C
}
public dosomething2()
{
//do something
}
}