void main() { Delegate nameFunctions; nameFunctions += SayHello; nameFunctions += SayGoodBye; //nameFunctions += PrintSum; // compiler error; PrintSum does not take a string as an argument nameFunctions("John Doe"); nameFunctions("Jane Doe"); Delegate numberFunctions; numberFunctions += PrintSum; numberFunctions += PrintDifference; numberFunctions(1,2); numberFunctions(2,2) /* Output is Hello John Doe Goodbye John Doe Hello Jane Doe Goodbye Jane Doe The sum is 3 The difference is -1 The sum is 4 The difference is 0 */ } void SayHello(string name) { cout << " Hello " << name; } void SayGoodbye(string name) { cout << " Goodbye " << name; } void PrintSum(int number1, int number2) { cout << " The sum is " << number1 + number2; } void PrintDifference(int number1, int number2) { cout << "The difference is " << number1 - number2; }