Created
August 28, 2015 12:12
-
-
Save chuck0523/7c99a771927494e6c77b 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 | |
log = (x) -> console.log x | |
# 大文字から始まる | |
class User | |
constructor : (name) -> | |
this.name = name | |
# thisは@で置き換えてもOK | |
me = new User "chuck" | |
log me.name | |
class User | |
constructor : (@name) -> | |
hello : -> log "hello, #{@name}" | |
you = new User "you" | |
you.hello() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment