Skip to content

Instantly share code, notes, and snippets.

@qwertie
Created August 7, 2018 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qwertie/4623dab626ad07e1834906f1a8868e00 to your computer and use it in GitHub Desktop.
Save qwertie/4623dab626ad07e1834906f1a8868e00 to your computer and use it in GitHub Desktop.
class Box {
width: number;
height: number;
constructor(width: number, height: number) {
this.width = width;
this.height = height;
}
get area() { return this.width*this.height; }
setSquare(side: number) {
this.width = this.height = side;
}
static ZeroSize() { return new Box(0, 0); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment