previous |
start |
next
Using a Strategy Interface
- Drawbacks of Measurable interface:
-
- must modify class, add interface and method
- can measure a class in only one way
- Remedy: Hand the object to be measured to a method:
public interface Measurer
{
double measure(Object anObject);
}
- Object is the "lowest common denominator" of all
classes
previous |
start |
next