previous | start | next

Using a Strategy Interface


class RectangleMeasurer implements Measurer
{
public double measure(Object anObject)
{
Rectangle aRectangle = (Rectangle)anObject;
double area = aRectangle.getWidth() * aRectangle.getHeight();
return area;
}
}


previous | start | next