Skip to content

Prototype

Sam Wang edited this page Oct 9, 2019 · 1 revision

Java

public class Prototype implements Cloneable {
  public Prototype clone() throws CloneNotSupportedException {
    return (Prototype) super.clone();
  }
}

// main
class Example {
  public static void main(String[] arguments) {
    var original = new Prototype();
    var clone = original.clone();
  }
}

TypeScript

// main
const original = {};
const clone = {...original};
Clone this wiki locally