Skip to content

Instantly share code, notes, and snippets.

@chul-hyun
Last active September 10, 2018 14:14
Show Gist options
  • Save chul-hyun/6a35d6ec3e8b31bb96bb567eaa80c37b to your computer and use it in GitHub Desktop.
Save chul-hyun/6a35d6ec3e8b31bb96bb567eaa80c37b to your computer and use it in GitHub Desktop.
유지보수가 쉬운 코드
class Gear {
constructor(readonly chainring: number, readonly cog: number) {}
ratio() {
return this.chainring / this.cog;
}
}
class Gear {
constructor(private _chainring: number, private _cog: number) {}
get chainring() {
return this._chainring;
}
get cog() {
return this._cog;
}
ratio() {
return this.chainring / this.cog;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment