Last active
September 10, 2018 14:14
-
-
Save chul-hyun/6a35d6ec3e8b31bb96bb567eaa80c37b to your computer and use it in GitHub Desktop.
유지보수가 쉬운 코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Gear { | |
constructor(readonly chainring: number, readonly cog: number) {} | |
ratio() { | |
return this.chainring / this.cog; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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