Skip to content

Commit a9c3df7

Browse files
dgruntziluwatar
authored andcommitted
Changes the description of the prototype pattern (iluwatar#1102)
1 parent 1fbe9bb commit a9c3df7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

prototype/README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ class Sheep implements Cloneable {
4040
public void setName(String name) { this.name = name; }
4141
public String getName() { return name; }
4242
@Override
43-
public Sheep clone() throws CloneNotSupportedException {
44-
return new Sheep(name);
43+
public Sheep clone() {
44+
try {
45+
return (Sheep)super.clone();
46+
} catch(CloneNotSuportedException) {
47+
throw new InternalError();
48+
}
4549
}
4650
}
4751
```

0 commit comments

Comments
 (0)