Many programming languages support a technique called default / optional parameters. This allows the programmer to make one or several parameters optional by giving a default value. This is particularly practical when adding functionality to the existing code
string Substring (int startIndex) string Substring (int startIndex, int length)
class SillyMath { public static int Plus(int number1, int number2) { return Plus(number1, number2, 0); } public static int Plus(int number1, int number2, int number3) { return number1 + number2 + number3; } }
class SillyMath { public static int Plus(int number1, int number2) { return Plus(number1, number2, 0); } public static int Plus(int number1, int number2, int number3) { return Plus(number1, number2, number3, 0); } public static int Plus(int number1, int number2, int number3, int number4) { return number1 + number2 + number3 + number4; } }
0 comments:
Post a Comment