Prototype Pattern


Prototype Pattern

프로토타입 패턴 프로토타입 패턴을 통해 복잡한 인스턴스를 복사 생산 비용이 높은 인스턴스를 복사를 통해서 쉽게 생성 할 수 있도록 하는 패턴 생상비용이 높은 인스턴스란? 1. 종류가 너무 많아서 클래스로 정리되지 않는 경우 2. 클래스로부터 인스턴스 생성이 어려운 경우 요구사항 그림그리기 툴 개발 복사 붙여넣기 기능 구현하기. Shape.java public class Shape implements Cloneable{ private String id; public void setId(String id) { this.id = id; } public String getId() { return id; } } Clone.java public class Circle extends Shape { private int x,y,r; public Circle(int x, int y, int r){ super(); this.x=x; this.y=y; this.r=r; } public Circle co...


#Prototype #프로토타입패턴

원문링크 : Prototype Pattern