Skip to content

Instantly share code, notes, and snippets.

@littleli
Last active May 17, 2017 23:09
Show Gist options
  • Save littleli/1a1b27bbc143a171b334f780f49f199b to your computer and use it in GitHub Desktop.
Save littleli/1a1b27bbc143a171b334f780f49f199b to your computer and use it in GitHub Desktop.
Bicycle
class Bicycle {
constructor(public cadence: number, private _speed: number, public gear: number) {}
speed = this._speed
applyBrake = (decrement: number) => this._speed -= decrement
sppedUp = (increment: number) => this._speed += increment
toString = () => `Bicycle: ${this._speed} mph`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment