728x90 반응형 패턴적용하기1 22-04-11-비지터패턴-2부-패턴적용하기 01.비지터패턴 적용하기 01.1 Shape.java before public interface Shape { void printTo(Device device); }// 모든 디바이스에 쓰기 위함 after public interface Shape { void printTo(Phone phone); void printTo(Watch watch); } 01.2 Circle.java before public class Circle implements Shape{ @Override public void printTo(Device device){ if(device instanceof Phone){ System.out.println("print Circle to Phone"); }else if(device ins.. 2022. 4. 12. 이전 1 다음 728x90 반응형