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 void setName(String name) { this.name = name; }
|
||||||
public String getName() { return name; }
|
public String getName() { return name; }
|
||||||
@Override
|
@Override
|
||||||
public Sheep clone() throws CloneNotSupportedException {
|
public Sheep clone() {
|
||||||
return new Sheep(name);
|
try {
|
||||||
|
return (Sheep)super.clone();
|
||||||
|
} catch(CloneNotSuportedException) {
|
||||||
|
throw new InternalError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user