Cloning using a copy factory
suggest changepublic class Sheep {
private String name;
private int weight;
public Sheep(String name, int weight) {
this.name = name;
this.weight = weight;
}
public static Sheep newInstance(Sheep other);
return new Sheep(other.name, other.weight)
}
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents