using System;
namespace Example_3_第六章
{
 /// <summary>
 /// Class1 的摘要说明。
 /// </summary>
 class Class1
 {
  /// <summary>
  /// 应用程序的主入口点。
  /// </summary>
  [STAThread]
  static void Main(string[] args)
  {
   //
   // TODO: 在此处添加代码以启动应用程序
   //
   // 存储结果的变量
   int result;
   // 委托的对象
   Call objCall;
   // Math 类的对象
   Math objMath=new Math();
   // 实例化委托
   objCall=new Call(objMath.Multiply);
   // 调用委托
   result=objCall(5.3);
   System.Console.WriteLine("结果为:{0}",result);
  }
 }
 class Delegates
 {
  // 委托定义
  public delegate int Call(int num1, int num2);
  class Math
  {
   // 乘法方法
   public int Multiply(int num1,int num2)
   {
    return num1*num2;
   }
   // 除法方法
   public int Divide(int num1, int num2)
   {
    return num1/num2;
   }
  }
 }
}



 
											





 
	    

 
	
