using System;
namespace NilPointer
{
class Program
{
public delegate double CalCulate(double a, double b);
public static double Add(double a, double b)
{
return a + b;
}
public static double Sub(double a, double b)
{
return a - b;
}
public static double Mul(double a, double b)
{
return a * b;
}
static void Main(string[] args)
{
CalCulate calCulate = Add;
Console.WriteLine("Add: " + calCulate(1, 2));
calCulate = Sub;
Console.WriteLine("Sub: " + calCulate(10, 2));
calCulate = Mul;
Console.WriteLine("Mul: " + calCulate(10, 2));
Console.ReadLine();
}
}
}
Add: 3
Sub: 8
Mul: 20