C# Override with different parameters?

后端 未结 5 1525
天命终不由人
天命终不由人 2020-12-11 16:29

Here is an example of what I am looking to do.

public class A
{
    public virtual void DoSomething(string a)
    {
      // perform something
    }
}
public         


        
5条回答
  •  庸人自扰
    2020-12-11 16:47

    No, this would be overloading. Since the logic would be 'slightly different' it sounds like you would need two different methods anyway? You could put your similar logic in a 3rd method and call that from both DoSomething(string A) and DoSomething(string A, string B)

提交回复
热议问题