Changes the description of the prototype pattern (#1102)
This commit is contained in:
committed by
Ilkka Seppälä
parent
1fbe9bbac5
commit
a9c3df78ee
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user