Generic methods and method overloading

前端 未结 6 1198
情歌与酒
情歌与酒 2020-11-29 09:30

Method overloading allows us to define many methods with the same name but with a different set of parameters ( thus with the same name but different signature ).

A

6条回答
  •  情歌与酒
    2020-11-29 09:51

    Yes, they are. They will allow code as such:

    A.MyMethod("a string"); // calls the generic version
    A.MyMethod(42);  // calls the int version
    

提交回复
热议问题