Methods
within a class can have the same name with different signature. In C#, methods
are overloaded by using
a. Number of parameters
b. Type of parameters
c. Kind of parameters (value, ref (or)
out)
class Arithmetic { public int sum(int a, int b) { return a + b; } public float sum(int a, float b) { return a + b; } public void sum(int a, out int b) { b = a + a; } public int sum(ref int a, ref int b) { return a + b; } }
No comments:
Post a Comment