Created
June 2, 2014 23:57
-
-
Save 8bitDesigner/15295fcd2b8216cf0bde 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 Foo | |
bar: -> 'bar' # Defining an instance method | |
Foo::baz = -> 'baz' # Appending an instance method on the class prototype | |
Foo.bacon = -> 'tasty' # Definining a method on the class itself | |
# Instance methods | |
foo = new Foo() | |
foo.bar() # bar | |
foo.baz() # baz | |
foo.bacon() # undefined | |
# Static methods | |
Foo.bacon() # tasty | |
Foo.bar() # undefined | |
Foo.baz() # undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And the static/instance methods can have the same name: