我知道我可以通过这样的方法:
Class A:
public void foo(Action<Class, Class, Class> bar)
{
Class a;
Class b;
Class c;
bar(a, b, c);
}
Class B:
public main()
{
foo(bar);
}
protected void bar(Class a, Class b, Class c);
但我希望它更有条件:
Class A:
public void foo(bar) {
Class a;
Class b;
Class c;
Class d;
if(condition A)
bar(a, b, c);
else
bar(a, b, c, d);
}
Class B:
public main()
{
foo(bar);
}
protected void bar(Class a, Class b, Class c);
protected void bar(Class a, Class b, Class c, Class d);
我该怎么做呢?