同一个接口,两个类:代理类和做事的那个类。使用代理类调用做事的类来完成任务
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DesignPytternDemo
{
public interface ISend
{
void Send(object data);
}
public class ReqSend : ISend
{
public void Send(object data)
{
Console.WriteLine("send data in reqSender data: {0}",data);
}
}
public class SendProxy : ISend
{
ReqSend rs;
public void Send(object data)
{
rs = new ReqSend();
rs.Send(data);
}
}
}