首页 > 代码库 > DesignPattern_Behavioral_Strategy

DesignPattern_Behavioral_Strategy

void Main(){    Product product = new Product();    product.Set(new ShowA());    product.Show();    product.Set(new ShowB());    product.Show();}class Product{    IShow ishow;    public void Set(IShow isw){ishow=isw;}    public void Show(){        ishow.Show();    }}interface IShow{    void Show();}class ShowA:IShow{    public void Show(){}}class ShowB:IShow{    public void Show(){}}

 

DesignPattern_Behavioral_Strategy