From a9c3df78ee6f51f1678a9521d74b93e127e734e2 Mon Sep 17 00:00:00 2001 From: Dominik Gruntz Date: Tue, 19 Nov 2019 20:57:20 +0100 Subject: [PATCH] Changes the description of the prototype pattern (#1102) --- prototype/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/prototype/README.md b/prototype/README.md index 483a5e469..4cb8c0365 100644 --- a/prototype/README.md +++ b/prototype/README.md @@ -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(); + } } } ```