Changes the description of the prototype pattern (#1102)

This commit is contained in:
Dominik Gruntz
2019-11-19 20:57:20 +01:00
committed by Ilkka Seppälä
parent 1fbe9bbac5
commit a9c3df78ee

View File

@ -40,8 +40,12 @@ class Sheep implements Cloneable {
public void setName(String name) { this.name = name; }
public String getName() { return name; }
@Override
public Sheep clone() throws CloneNotSupportedException {
return new Sheep(name);
public Sheep clone() {
try {
return (Sheep)super.clone();
} catch(CloneNotSuportedException) {
throw new InternalError();
}
}
}
```