//c# delegate
//delegates are type-safe Pointers to Methods.
// example
using System;
public class Program{
// define delegate
public delegate void subtraction(int a, int b);
//define method that you want to point to that delegate
public void sub_numbers(int c, int d){
Console.WriteLine($"Sub of two numbers is {c-d}");
}
public static void Main(){
// instantiate class
var p = new Program();
// instantiate delegate and pass method as parameter
// in which you want to point
var del_sub = new subtraction(p.sub_numbers);
// call delegate and pass the parameter
del_sub(50,20); // output: Sub of two numbers is 30