为其他对象提供一个代理或地方以控制对这个对象的访问。

/**//*--------------------------------------------------------------
Copyright (c) 2008 Ly. All rights reserved.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
using System;

class Math

...{
public double Add(double x, double y)

...{
return x+y;
}
}


class MathProxy

...{
Math math;
public MathProxy()

...{
math=new Math();
}

public double Add(double x, double y)

...{
return math.Add(x, y);
}
}

class ProxyApp

...{
public static void Main(string []args)

...{
MathProxy proxy=new MathProxy();

Console.WriteLine("4+2={0}",proxy.Add(4, 2));
}
}















































