Method Overloading with Optional Parameter

前端 未结 3 1227
甜味超标
甜味超标 2021-01-17 07:56

I have a class as follows with two overload method.

Class A
{
    public string x(string a, string b)
    {
        return \"hello\" + a + b;
    }

    publ         


        
3条回答
  •  一个人的身影
    2021-01-17 08:25

    If you call the Method with two Parameters, it uses the Method with two Parameters. If you'd call the one with three, it would use the other.

提交回复
热议问题