Delegate overloading

  • Thread starter Thread starter Edward Diener
  • Start date Start date
E

Edward Diener

According to the documentation, delegates can not be overloaded.

Does this mean that a delegate must have a distinct name in all namespaces,
or does this mean that a delegate must have a distinct name in any one given
namespace ? I sincerely hope it is the latter.
 
Well, if minimal constraint is your goal, you are going to be pleased.
Overloading is creating several methods with the same name *in the same
class*. For example, these are overloaded methods:

Add(int a, int b) {return a+b;}
Add(int a, int b, int c) {return a+b+c;}
Add(int a, int b, int c, int d) {return a+b+c+d;}
 
Back
Top