Created
August 15, 2012 21:41
-
-
Save EvanHahn/3363965 to your computer and use it in GitHub Desktop.
Simple private member functions in CoffeeScript
This file contains hidden or 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
# There's more complexity to this, as described below: | |
# http://evanhahn.com/?p=1126 | |
class Person | |
hello = -> | |
"hello" | |
helloWorld: -> | |
"#{hello()} world!" | |
me = new Person | |
me.helloWorld() # => "hello world!" | |
me.hello() # => TypeError, method not found -- good! | |
# This code by Evan Hahn (evanhahn.com) is licensed under the Unlicense. | |
# http://unlicense.org/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment