{
public int sides()
{
return numSides;
}
public Dice(int i)
{
numSides = i;
load = null;
}
public void load(RollStrategy r)
{
load = r;
}
public int roll()
{
int i = -1;
if (load != null)
{
i = load.roll();
}
return i;
}
private int numSides;
private RollStrategy load;
}
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/