Last active
December 14, 2015 04:59
-
-
Save xsurge83/5032128 to your computer and use it in GitHub Desktop.
Private and public methods
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
class MyClass2 | |
self = 'default' | |
console.log 'invoked once invoke me once per load' | |
constructor: -> | |
my21 = new MyClass2(); | |
my22 = new MyClass2(); | |
MyClass= -> | |
self = 'default' | |
console.log('invoked once per instance'); | |
p: 'public' | |
set: (value)-> | |
self = value | |
get:-> | |
return self | |
first = new MyClass() | |
second = new MyClass() | |
first.set('me') | |
second.set('me2') | |
console.log first.get() | |
console.log second.get() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment