package com.pattern.StrategyPattern.po; /** * @author lx * @date 2021/10/13 11:30 **/ public class Context { /** * 本次策略规则对象 */ private final Strategy strategy; public Context(Strategy strategy) { this.strategy = strategy; } public int exec(int a, int b) { return strategy.exec(a, b); } }