스트래티지 패턴1 스트래티지 패턴 (Strategy Pattern) public abstract class Robot { private String name; public Robot(String name) { this.name = name; } public String getName() { return name; } public abstract void attack(); public abstract void move(); } public class Robot1 extends Robot { public Robot1(String name) { super(name; } public void attack() { System.out.println("I have punch"); } public void move() { System.out.println("I can only walk.. 2022. 7. 6. 이전 1 다음