设计模式-行为型01-策略模式(strategy)
发布日期:2021-05-10 03:41:13 浏览次数:16 分类:精选文章

本文共 2244 字,大约阅读时间需要 7 分钟。

���������Strategy������������An Overview

���������������Strategy������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������

  • ���������Interface���������������������������������������������������������������������������������������������������
  • ������������Abstract Class������������������������������������������������������������������������������������������������������������������������������������������������������
  • ������������������Several Implementations������������������������������������������������������������������������������������
  • ������������������������Uniform Entry Points���������������������������������������������������������������������������������������������������������
  • ������������������������������

    public interface ICalculator {
    public int calculate(String exp);
    }

    ���������������������

  • ���������������������������������������������������������������������������������������������������������
  • ������������������������������������������������������������
  • ������������������������������������������������������������������������������������������������
  • ������������������������������������������������������������������������������
  • ������������������

    ���������������������������������������������������������������������������������������������������

    • ������������������������
    • ���������������������
    • ���������������Helper Methods���

    ������������������

  • DefaultStrategy���������������������������������������������������
  • AddStrategy������������������������
  • SubtractStrategy������������������������
  • MultiplyStrategy������������������������
  • DivideStrategy������������������������
  • ������������������������������

    ������������������������������������������������������������

    • ������������
    • ���������������
    • ������������Transformer���
    • ������������������Strategy Executor���

    ������������������

    ���������������������������������������������������������������������������������������������������������������������������������������������������������������

    上一篇:设计模式-行为型02-模板方法模式(Template Method)
    下一篇:设计模式-结构性07-享元模式(Flyweight)

    发表评论

    最新留言

    网站不错 人气很旺了 加油
    [***.192.178.218]2025年04月05日 00时05分55秒