public class Math {
public static double twoTime(double num){
return num*2;
}
public static double half(double num){
return num/2;
}
public static Double double(Double d) {
return d*2;
}
}
public interface Adapter{
public Float twiceOf(Float f);
public Float halfOf(Float f);
}
public class AdapterImpl implements Adapter {
@Override
public Float twiceOf(Float f) {
Math.twoTime();
}
@Override
public Float halfOf(Float f) {
Math.half();
}
}
'Java > Design Pattern' 카테고리의 다른 글
Template Method Pattern (0) | 2020.09.01 |
---|---|
전략 패턴(Strategy Pattern) (0) | 2020.08.23 |